From 879bff854e4a94c28b777781439c60724bca0892 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 1 Nov 2022 21:46:07 +0530 Subject: [PATCH] Update subscription date on public unsubscribe. Closes #915. --- queries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries.sql b/queries.sql index 685e610..d1641f3 100644 --- a/queries.sql +++ b/queries.sql @@ -226,7 +226,7 @@ sub AS ( UPDATE subscribers SET status = (CASE WHEN $3 IS TRUE THEN 'blocklisted' ELSE status END) WHERE uuid = $2 RETURNING id ) -UPDATE subscriber_lists SET status = 'unsubscribed' WHERE +UPDATE subscriber_lists SET status = 'unsubscribed', updated_at=NOW() WHERE subscriber_id = (SELECT id FROM sub) AND status != 'unsubscribed' AND -- If $3 is false, unsubscribe from the campaign's lists, otherwise all lists. CASE WHEN $3 IS FALSE THEN list_id = ANY(SELECT list_id FROM lists) ELSE list_id != 0 END;