mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
re: #2098, chat message emails are now opt-in
This commit is contained in:
@@ -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,6 +376,8 @@ var db = require('./database'),
|
||||
}
|
||||
});
|
||||
|
||||
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,
|
||||
@@ -385,6 +387,8 @@ var db = require('./database'),
|
||||
url: nconf.get('url') + '/chats/' + utils.slugify(messageObj.fromUser.username)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}(exports));
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user