mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: closes #13022, don't do anything if notif setting isnt set to email
This commit is contained in:
@@ -113,8 +113,14 @@ const doUnsubscribe = async (payload) => {
|
||||
user.updateDigestSetting(payload.uid, 'off'),
|
||||
]);
|
||||
} else if (payload.template === 'notification') {
|
||||
const currentToNewSetting = {
|
||||
notificationemail: 'notification',
|
||||
email: 'none',
|
||||
};
|
||||
const current = await db.getObjectField(`user:${payload.uid}:settings`, `notificationType_${payload.type}`);
|
||||
await user.setSetting(payload.uid, `notificationType_${payload.type}`, (current === 'notificationemail' ? 'notification' : 'none'));
|
||||
if (currentToNewSetting.hasOwnProperty(current)) {
|
||||
await user.setSetting(payload.uid, `notificationType_${payload.type}`, currentToNewSetting[current]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user