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_daily": "Daily",
|
||||||
"digest_weekly": "Weekly",
|
"digest_weekly": "Weekly",
|
||||||
"digest_monthly": "Monthly",
|
"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 :(",
|
"has_no_follower": "This user doesn't have any followers :(",
|
||||||
"follows_no_one": "This user isn't following anyone :(",
|
"follows_no_one": "This user isn't following anyone :(",
|
||||||
|
|||||||
@@ -376,13 +376,17 @@ var db = require('./database'),
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
emailer.send('notif_chat', touid, {
|
user.getSettings(messageObj.toUser.uid, function(err, settings) {
|
||||||
subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]',
|
if (settings.sendChatNotifications && !parseInt(meta.config.disableEmailSubscriptions, 10)) {
|
||||||
username: messageObj.toUser.username,
|
emailer.send('notif_chat', touid, {
|
||||||
summary: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
|
subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]',
|
||||||
message: messageObj,
|
username: messageObj.toUser.username,
|
||||||
site_title: meta.config.site_title || 'NodeBB',
|
summary: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
|
||||||
url: nconf.get('url') + '/chats/' + utils.slugify(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.topicPostSort = settings.topicPostSort || meta.config.topicPostSort || 'oldest_to_newest';
|
||||||
settings.followTopicsOnCreate = (settings.followTopicsOnCreate === null || settings.followTopicsOnCreate === undefined) ? true : parseInt(settings.followTopicsOnCreate, 10) === 1;
|
settings.followTopicsOnCreate = (settings.followTopicsOnCreate === null || settings.followTopicsOnCreate === undefined) ? true : parseInt(settings.followTopicsOnCreate, 10) === 1;
|
||||||
settings.followTopicsOnReply = parseInt(settings.followTopicsOnReply, 10) === 1;
|
settings.followTopicsOnReply = parseInt(settings.followTopicsOnReply, 10) === 1;
|
||||||
|
settings.sendChatNotifications = parseInt(settings.sendChatNotifications, 10) === 1;
|
||||||
|
|
||||||
callback(null, settings);
|
callback(null, settings);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -83,7 +85,8 @@ module.exports = function(User) {
|
|||||||
notificationSounds: data.notificationSounds,
|
notificationSounds: data.notificationSounds,
|
||||||
language: data.language || meta.config.defaultLang,
|
language: data.language || meta.config.defaultLang,
|
||||||
followTopicsOnCreate: data.followTopicsOnCreate,
|
followTopicsOnCreate: data.followTopicsOnCreate,
|
||||||
followTopicsOnReply: data.followTopicsOnReply
|
followTopicsOnReply: data.followTopicsOnReply,
|
||||||
|
sendChatNotifications: data.sendChatNotifications
|
||||||
}, callback);
|
}, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user