daily digest settings in User Settings

v1.18.x
Julian Lam 11 years ago
parent 7c08831aaf
commit 15bf804fa7

@ -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 :(",

@ -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;
}

@ -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,

Loading…
Cancel
Save