re: #2098, chat message emails are now opt-in

v1.18.x
Julian Lam 11 years ago
parent b85ff61de6
commit b80b0e1e99

@ -57,6 +57,7 @@
"digest_daily": "Daily",
"digest_weekly": "Weekly",
"digest_monthly": "Monthly",
"send_chat_notifications": "Send an email if a new chat message arrives and I am not online",
"has_no_follower": "This user doesn't have any followers :(",
"follows_no_one": "This user isn't following anyone :(",

@ -376,13 +376,17 @@ var db = require('./database'),
}
});
emailer.send('notif_chat', touid, {
subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]',
username: messageObj.toUser.username,
summary: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
message: messageObj,
site_title: meta.config.site_title || 'NodeBB',
url: nconf.get('url') + '/chats/' + utils.slugify(messageObj.fromUser.username)
user.getSettings(messageObj.toUser.uid, function(err, settings) {
if (settings.sendChatNotifications && !parseInt(meta.config.disableEmailSubscriptions, 10)) {
emailer.send('notif_chat', touid, {
subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]',
username: messageObj.toUser.username,
summary: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
message: messageObj,
site_title: meta.config.site_title || 'NodeBB',
url: nconf.get('url') + '/chats/' + utils.slugify(messageObj.fromUser.username)
});
}
});
}
}

@ -35,6 +35,8 @@ module.exports = function(User) {
settings.topicPostSort = settings.topicPostSort || meta.config.topicPostSort || 'oldest_to_newest';
settings.followTopicsOnCreate = (settings.followTopicsOnCreate === null || settings.followTopicsOnCreate === undefined) ? true : parseInt(settings.followTopicsOnCreate, 10) === 1;
settings.followTopicsOnReply = parseInt(settings.followTopicsOnReply, 10) === 1;
settings.sendChatNotifications = parseInt(settings.sendChatNotifications, 10) === 1;
callback(null, settings);
});
});
@ -83,7 +85,8 @@ module.exports = function(User) {
notificationSounds: data.notificationSounds,
language: data.language || meta.config.defaultLang,
followTopicsOnCreate: data.followTopicsOnCreate,
followTopicsOnReply: data.followTopicsOnReply
followTopicsOnReply: data.followTopicsOnReply,
sendChatNotifications: data.sendChatNotifications
}, callback);
};

Loading…
Cancel
Save