|
|
@ -11,7 +11,7 @@ var async = require('async'),
|
|
|
|
batch = require('../batch'),
|
|
|
|
batch = require('../batch'),
|
|
|
|
emailer = require('../emailer');
|
|
|
|
emailer = require('../emailer');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = (function(Digest) {
|
|
|
|
(function(Digest) {
|
|
|
|
Digest.execute = function(interval) {
|
|
|
|
Digest.execute = function(interval) {
|
|
|
|
var digestsDisabled = meta.config.disableEmailSubscriptions !== undefined && parseInt(meta.config.disableEmailSubscriptions, 10) === 1;
|
|
|
|
var digestsDisabled = meta.config.disableEmailSubscriptions !== undefined && parseInt(meta.config.disableEmailSubscriptions, 10) === 1;
|
|
|
|
if (digestsDisabled) {
|
|
|
|
if (digestsDisabled) {
|
|
|
@ -71,14 +71,14 @@ module.exports = (function(Digest) {
|
|
|
|
|
|
|
|
|
|
|
|
user.getMultipleUserFields(data.subscribers, ['uid', 'username', 'lastonline'], function(err, users) {
|
|
|
|
user.getMultipleUserFields(data.subscribers, ['uid', 'username', 'lastonline'], function(err, users) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
winston.error('[user/jobs] Could not send digests (' + interval + '): ' + err.message);
|
|
|
|
winston.error('[user/jobs] Could not send digests (' + data.interval + '): ' + err.message);
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.eachLimit(users, 100, function(userObj, next) {
|
|
|
|
async.eachLimit(users, 100, function(userObj, next) {
|
|
|
|
user.notifications.getDailyUnread(userObj.uid, function(err, notifications) {
|
|
|
|
user.notifications.getDailyUnread(userObj.uid, function(err, notifications) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
winston.error('[user/jobs] Could not send digests (' + interval + '): ' + err.message);
|
|
|
|
winston.error('[user/jobs] Could not send digests (' + data.interval + '): ' + err.message);
|
|
|
|
return next(err);
|
|
|
|
return next(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -109,7 +109,6 @@ module.exports = (function(Digest) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, callback);
|
|
|
|
}, callback);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return Digest;
|
|
|
|
}(module.exports));
|
|
|
|
})({});
|
|
|
|
|
|
|
|