fix: closes #13022, don't do anything if notif setting isnt set to email

This commit is contained in:
Barış Soner Uşaklı
2025-01-04 09:37:10 -05:00
parent 29804a1093
commit fcf50a3c01

View File

@@ -113,8 +113,14 @@ const doUnsubscribe = async (payload) => {
user.updateDigestSetting(payload.uid, 'off'), user.updateDigestSetting(payload.uid, 'off'),
]); ]);
} else if (payload.template === 'notification') { } else if (payload.template === 'notification') {
const currentToNewSetting = {
notificationemail: 'notification',
email: 'none',
};
const current = await db.getObjectField(`user:${payload.uid}:settings`, `notificationType_${payload.type}`); 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; return true;
}; };