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",
|
"invisible": "Invisible",
|
||||||
"offline": "Offline",
|
"offline": "Offline",
|
||||||
|
|
||||||
"privacy": "Privacy",
|
"email": "Email",
|
||||||
"language": "Language"
|
"language": "Language"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,12 @@
|
|||||||
|
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"show_email": "Show My Email",
|
"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 :(",
|
"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 :(",
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ define(['forum/accountheader'], function(header) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (input.attr('type')) {
|
switch (input.attr('type')) {
|
||||||
case 'text' :
|
case 'text':
|
||||||
case 'textarea' :
|
case 'textarea':
|
||||||
settings[setting] = input.val();
|
settings[setting] = input.val();
|
||||||
break;
|
break;
|
||||||
case 'checkbox' :
|
case 'checkbox':
|
||||||
settings[setting] = input.is(':checked') ? 1 : 0;
|
settings[setting] = input.is(':checked') ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ module.exports = function(User) {
|
|||||||
}, function(err, data) {
|
}, function(err, data) {
|
||||||
var now = new Date();
|
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) {
|
User.getMultipleUserFields(data.uids, ['uid', 'username', 'lastonline'], function(err, receipients) {
|
||||||
// Find only those users who have not been online in the past 24 hours
|
// Find only those users who have not been online in the past 24 hours
|
||||||
var users = receipients.filter(function(userObj) {
|
var users = receipients.filter(function(userObj) {
|
||||||
return yesterday > parseInt(userObj.lastonline, 10);
|
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) {
|
async.each(users, function(userObj, next) {
|
||||||
user.notifications.getDailyUnread(userObj.uid, function(err, notifications) {
|
user.notifications.getDailyUnread(userObj.uid, function(err, notifications) {
|
||||||
// Turn relative URLs into absolute ones
|
// Turn relative URLs into absolute ones
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ module.exports = function(User) {
|
|||||||
settings = data.settings;
|
settings = data.settings;
|
||||||
|
|
||||||
settings.showemail = settings.showemail ? parseInt(settings.showemail, 10) !== 0 : false;
|
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.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.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;
|
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]]'));
|
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', {
|
db.setObject('user:' + uid + ':settings', {
|
||||||
showemail: data.showemail,
|
showemail: data.showemail,
|
||||||
|
enableDailyDigest: data.enableDailyDigest || 'daily',
|
||||||
usePagination: data.usePagination,
|
usePagination: data.usePagination,
|
||||||
topicsPerPage: data.topicsPerPage,
|
topicsPerPage: data.topicsPerPage,
|
||||||
postsPerPage: data.postsPerPage,
|
postsPerPage: data.postsPerPage,
|
||||||
|
|||||||
Reference in New Issue
Block a user