diff --git a/backend/api/src/unsubscribe.ts b/backend/api/src/unsubscribe.ts index 4c279af6..ad5ac577 100644 --- a/backend/api/src/unsubscribe.ts +++ b/backend/api/src/unsubscribe.ts @@ -57,7 +57,7 @@ export const unsubscribe: APIHandler<'unsubscribe/:token'> = async ({token}, _au SET data = jsonb_set( data, '{notificationPreferences,${notification_type}}', - (data->'notificationPreferences'->'${notification_type}' || '[]'::jsonb) - 'email' + (COALESCE(data->'notificationPreferences'->'${notification_type}', '["email", "browser", "mobile"]'::jsonb) - 'email') ) WHERE id = $1`, [user_id],