Skip to content

Commit

Permalink
Fix unsubbed subscribers not getting re-sub optin confirmation. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jul 12, 2023
1 parent d69b766 commit e1c0bf5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ INSERT INTO subscriber_lists (subscriber_id, list_id, status)
(CASE WHEN $4='blocklisted' THEN 'unsubscribed'::subscription_status ELSE $8::subscription_status END)
)
ON CONFLICT (subscriber_id, list_id) DO UPDATE
SET status = (CASE WHEN $4='blocklisted' THEN 'unsubscribed'::subscription_status ELSE subscriber_lists.status END);
SET status = (
CASE
WHEN $4='blocklisted' THEN 'unsubscribed'::subscription_status
-- When subscriber is edited from the admin form, retain the status. Otherwise, a blocklisted
-- subscriber when being re-enabled, their subscription statuses change.
WHEN $9 = TRUE THEN subscriber_lists.status
ELSE $8::subscription_status
END
);

-- name: delete-subscribers
-- Delete one or more subscribers by ID or UUID.
Expand Down

0 comments on commit e1c0bf5

Please sign in to comment.