Node.js based forum software built for the modern web
fix: closes #13022, don't do anything if notif setting isnt set to email
Barış Soner Uşaklıfcf50a3c0124
diff --git a/src/controllers/accounts/settings.js b/src/controllers/accounts/settings.jsindex 6248bc5ddd..8530486d7c 100644--- a/src/controllers/accounts/settings.js+++ b/src/controllers/accounts/settings.js@@ -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;};