mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
daily digest settings in User Settings
This commit is contained in:
@@ -69,6 +69,6 @@
|
||||
"invisible": "Invisible",
|
||||
"offline": "Offline",
|
||||
|
||||
"privacy": "Privacy",
|
||||
"email": "Email",
|
||||
"language": "Language"
|
||||
}
|
||||
|
||||
@@ -47,6 +47,12 @@
|
||||
|
||||
"settings": "Settings",
|
||||
"show_email": "Show My Email",
|
||||
"digest_label": "Subscribe to Digest",
|
||||
"digest_description": "Subscribe to email updates for this forum (new notifications and topics) according to a set schedule",
|
||||
"digest_off": "Off",
|
||||
"digest_daily": "Daily",
|
||||
"digest_weekly": "Weekly",
|
||||
"digest_monthly": "Monthly",
|
||||
|
||||
"has_no_follower": "This user doesn't have any followers :(",
|
||||
"follows_no_one": "This user isn't following anyone :(",
|
||||
|
||||
@@ -34,13 +34,13 @@ module.exports = function(User) {
|
||||
}, function(err, data) {
|
||||
var now = new Date();
|
||||
|
||||
// Consider using eachLimit, but *only* if people complain about email relays choking -- otherwise we're ok.
|
||||
User.getMultipleUserFields(data.uids, ['uid', 'username', 'lastonline'], function(err, receipients) {
|
||||
// Find only those users who have not been online in the past 24 hours
|
||||
var users = receipients.filter(function(userObj) {
|
||||
return yesterday > parseInt(userObj.lastonline, 10);
|
||||
});
|
||||
|
||||
// Consider using eachLimit, but *only* if people complain about email relays choking -- otherwise we're ok.
|
||||
async.each(users, function(userObj, next) {
|
||||
user.notifications.getDailyUnread(userObj.uid, function(err, notifications) {
|
||||
// Turn relative URLs into absolute ones
|
||||
|
||||
@@ -25,6 +25,7 @@ module.exports = function(User) {
|
||||
settings = data.settings;
|
||||
|
||||
settings.showemail = settings.showemail ? parseInt(settings.showemail, 10) !== 0 : false;
|
||||
settings.enableDailyDigest = settings.enableDailyDigest || 'daily';
|
||||
settings.usePagination = settings.usePagination ? parseInt(settings.usePagination, 10) === 1 : parseInt(meta.config.usePagination, 10) === 1;
|
||||
settings.topicsPerPage = settings.topicsPerPage ? parseInt(settings.topicsPerPage, 10) : parseInt(meta.config.topicsPerPage, 10) || 20;
|
||||
settings.postsPerPage = settings.postsPerPage ? parseInt(settings.postsPerPage, 10) : parseInt(meta.config.postsPerPage, 10) || 10;
|
||||
@@ -41,10 +42,12 @@ module.exports = function(User) {
|
||||
return callback(new Error('[[error:invalid-pagination-value]]'));
|
||||
}
|
||||
|
||||
plugins.fireHook('action:user.saveSettings', {uid: uid, settings: data});
|
||||
data.language = data.language || meta.config.defaultLang;
|
||||
|
||||
plugins.fireHook('action:user.saveSettings', {uid: uid, settings: data});
|
||||
db.setObject('user:' + uid + ':settings', {
|
||||
showemail: data.showemail,
|
||||
enableDailyDigest: data.enableDailyDigest || 'daily',
|
||||
usePagination: data.usePagination,
|
||||
topicsPerPage: data.topicsPerPage,
|
||||
postsPerPage: data.postsPerPage,
|
||||
|
||||
Reference in New Issue
Block a user