Skip to content

Commit

Permalink
Properly fall back to error if token doesn't match
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinnl committed Oct 31, 2024
1 parent c2e3402 commit 08ccb2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/db/tables/subscriber_email_preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ async function unsubscribeMonthlyMonitorReportForUnsubscribeToken(
sub = await getEmailPreferenceForUnsubscribeToken(unsubscribeToken);

if (
typeof sub.id === "number" &&
typeof sub?.id === "number" &&
sub.monthly_monitor_report_free === false
) {
logger.info(
"unsubscribe_monthly_monitor_report_for_unsubscribe_token_already_unsubscribed",
);
} else if (typeof sub.id === "number") {
} else if (typeof sub?.id === "number") {
await updateEmailPreferenceForSubscriber(sub.id, true, {
monthly_monitor_report_free: false,
});
Expand Down

0 comments on commit 08ccb2f

Please sign in to comment.