Refactor dummyUser struct for use in multiple places
This commit is contained in:
parent
b63e3907c5
commit
acee18c58c
|
@ -117,12 +117,7 @@ func handlePreviewCampaign(c echo.Context) error {
|
||||||
if err := app.Queries.GetOneCampaignSubscriber.Get(&sub, camp.ID); err != nil {
|
if err := app.Queries.GetOneCampaignSubscriber.Get(&sub, camp.ID); err != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
// There's no subscriber. Mock one.
|
// There's no subscriber. Mock one.
|
||||||
sub = models.Subscriber{
|
sub = dummySubscriber
|
||||||
Name: "Dummy Subscriber",
|
|
||||||
Email: "dummy@subscriber.com",
|
|
||||||
UUID: "00000000-0000-0000-0000-000000000000",
|
|
||||||
Status: models.SubscriberStatusEnabled,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError,
|
return echo.NewHTTPError(http.StatusInternalServerError,
|
||||||
fmt.Sprintf("Error fetching subscriber: %s", pqErrMsg(err)))
|
fmt.Sprintf("Error fetching subscriber: %s", pqErrMsg(err)))
|
||||||
|
|
|
@ -38,7 +38,15 @@ type queryAddReq struct {
|
||||||
TargetLists pq.Int64Array `json:"target_lists"`
|
TargetLists pq.Int64Array `json:"target_lists"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsonMap = []byte("{}")
|
var (
|
||||||
|
jsonMap = []byte("{}")
|
||||||
|
|
||||||
|
dummySubscriber = models.Subscriber{
|
||||||
|
Email: "dummy@listmonk.app",
|
||||||
|
Name: "Dummy Subscriber",
|
||||||
|
UUID: "00000000-0000-0000-0000-000000000000",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// handleGetSubscriber handles the retrieval of a single subscriber by ID.
|
// handleGetSubscriber handles the retrieval of a single subscriber by ID.
|
||||||
func handleGetSubscriber(c echo.Context) error {
|
func handleGetSubscriber(c echo.Context) error {
|
||||||
|
|
|
@ -27,11 +27,6 @@ const (
|
||||||
<p>Here is a link to <a href="https://listmonk.app" target="_blank">listmonk</a>.</p>`
|
<p>Here is a link to <a href="https://listmonk.app" target="_blank">listmonk</a>.</p>`
|
||||||
)
|
)
|
||||||
|
|
||||||
var dummySubscriber = models.Subscriber{
|
|
||||||
Email: "dummy@listmonk.app",
|
|
||||||
Name: "Dummy User",
|
|
||||||
}
|
|
||||||
|
|
||||||
type dummyMessage struct {
|
type dummyMessage struct {
|
||||||
UnsubscribeURL string
|
UnsubscribeURL string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue