diff --git a/public/language/en_GB/global.json b/public/language/en_GB/global.json index c935f1c5d8..de15a7e4ce 100644 --- a/public/language/en_GB/global.json +++ b/public/language/en_GB/global.json @@ -69,6 +69,6 @@ "invisible": "Invisible", "offline": "Offline", - "privacy": "Privacy", + "email": "Email", "language": "Language" } diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json index 1ca6651efb..a9a384da43 100644 --- a/public/language/en_GB/user.json +++ b/public/language/en_GB/user.json @@ -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 :(", diff --git a/public/src/forum/accountsettings.js b/public/src/forum/accountsettings.js index bb18cacb2c..4945eb8abb 100644 --- a/public/src/forum/accountsettings.js +++ b/public/src/forum/accountsettings.js @@ -16,11 +16,11 @@ define(['forum/accountheader'], function(header) { } switch (input.attr('type')) { - case 'text' : - case 'textarea' : + case 'text': + case 'textarea': settings[setting] = input.val(); break; - case 'checkbox' : + case 'checkbox': settings[setting] = input.is(':checked') ? 1 : 0; break; } diff --git a/src/user/jobs.js b/src/user/jobs.js index c28519eecf..520075281c 100644 --- a/src/user/jobs.js +++ b/src/user/jobs.js @@ -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 diff --git a/src/user/settings.js b/src/user/settings.js index ab80e4fb42..6dd9b6817e 100644 --- a/src/user/settings.js +++ b/src/user/settings.js @@ -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,