Add document unsubscribe link in email footer (#5762)
This commit is contained in:
@@ -33,11 +33,8 @@ const handleUnsubscribe = async (
|
||||
const userId = (ctx.input.body.userId ?? ctx.input.query.userId) as string;
|
||||
const token = (ctx.input.body.token ?? ctx.input.query.token) as string;
|
||||
|
||||
const user = await User.scope("withTeam").findByPk(userId, {
|
||||
rejectOnEmpty: true,
|
||||
});
|
||||
const unsubscribeToken = NotificationSettingsHelper.unsubscribeToken(
|
||||
user,
|
||||
userId,
|
||||
eventType
|
||||
);
|
||||
|
||||
@@ -46,6 +43,10 @@ const handleUnsubscribe = async (
|
||||
return;
|
||||
}
|
||||
|
||||
const user = await User.scope("withTeam").findByPk(userId, {
|
||||
rejectOnEmpty: true,
|
||||
});
|
||||
|
||||
user.setNotificationEventType(eventType, false);
|
||||
await user.save();
|
||||
ctx.redirect(`${user.team.url}/settings/notifications?success`);
|
||||
|
||||
Reference in New Issue
Block a user