From 54c638c3c8a0ead5cca4aa61e40198cad3c45926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 19 Oct 2018 08:26:22 -0400 Subject: [PATCH] fix upgrade script for notification types --- src/upgrades/1.7.6/notification_types.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/upgrades/1.7.6/notification_types.js b/src/upgrades/1.7.6/notification_types.js index d8d7636b9c..7064a7ac24 100644 --- a/src/upgrades/1.7.6/notification_types.js +++ b/src/upgrades/1.7.6/notification_types.js @@ -12,12 +12,14 @@ module.exports = { db.getObject('config', next); }, function (config, next) { + var postNotifications = parseInt(config.sendPostNotifications, 10) === 1 ? 'notification' : 'none'; + var chatNotifications = parseInt(config.sendChatNotifications, 10) === 1 ? 'notification' : 'none'; db.setObject('config', { notificationType_upvote: config.notificationType_upvote || 'notification', 'notificationType_new-topic': config['notificationType_new-topic'] || 'notification', - 'notificationType_new-reply': config['notificationType_new-reply'] || config.sendPostNotifications || 'notification', + 'notificationType_new-reply': config['notificationType_new-reply'] || postNotifications, notificationType_follow: config.notificationType_follow || 'notification', - 'notificationType_new-chat': config['notificationType_new-chat'] || config.sendChatNotifications || 'notification', + 'notificationType_new-chat': config['notificationType_new-chat'] || chatNotifications, 'notificationType_group-invite': config['notificationType_group-invite'] || 'notification', }, next); },