High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
Rename unsub query to match the `core` method name.
Kailash Nadh959541f8eeab
diff --git a/internal/core/subscribers.go b/internal/core/subscribers.goindex dcb4b231..5c1a8677 100644--- a/internal/core/subscribers.go+++ b/internal/core/subscribers.go@@ -399,7 +399,7 @@ func (c *Core) DeleteSubscribersByQuery(query string, listIDs []int) error {// UnsubscribeByCampaign unsubscibers a given subscriber from lists in a given campaign.func (c *Core) UnsubscribeByCampaign(subUUID, campUUID string, blocklist bool) error {- if _, err := c.q.Unsubscribe.Exec(campUUID, subUUID, blocklist); err != nil {+ if _, err := c.q.UnsubscribeByCampaign.Exec(campUUID, subUUID, blocklist); err != nil {c.log.Printf("error unsubscribing: %v", err)return echo.NewHTTPError(http.StatusInternalServerError,c.i18n.Ts("globals.messages.errorUpdating", "name", "{globals.terms.subscribers}", "error", pqErrMsg(err)))diff --git a/models/queries.go b/models/queries.goindex ee4bef88..501d980f 100644--- a/models/queries.go+++ b/models/queries.go@@ -28,7 +28,7 @@ type Queries struct {ConfirmSubscriptionOptin *sqlx.Stmt `query:"confirm-subscription-optin"`UnsubscribeSubscribersFromLists *sqlx.Stmt `query:"unsubscribe-subscribers-from-lists"`DeleteSubscribers *sqlx.Stmt `query:"delete-subscribers"`- Unsubscribe *sqlx.Stmt `query:"unsubscribe"`+ UnsubscribeByCampaign *sqlx.Stmt `query:"unsubscribe-by-campaign"`ExportSubscriberData *sqlx.Stmt `query:"export-subscriber-data"`// Non-prepared arbitrary subscriber queries.diff --git a/queries.sql b/queries.sqlindex 3646a7b6..c79a244e 100644--- a/queries.sql+++ b/queries.sql@@ -174,7 +174,7 @@ UPDATE subscriber_lists SET status='confirmed', updated_at=NOW()UPDATE subscriber_lists SET status='unsubscribed', updated_at=NOW()WHERE (subscriber_id, list_id) = ANY(SELECT a, b FROM UNNEST($1::INT[]) a, UNNEST($2::INT[]) b);--- name: unsubscribe+-- name: unsubscribe-by-campaign-- Unsubscribes a subscriber given a campaign UUID (from all the lists in the campaign) and the subscriber UUID.-- If $3 is TRUE, then all subscriptions of the subscriber is blocklisted-- and all existing subscriptions, irrespective of lists, unsubscribed.