Skip to content

Commit

Permalink
show real emails sent number
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Jan 23, 2018
1 parent 3ebb885 commit d70cdf1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/user/digest.js
Expand Up @@ -90,8 +90,9 @@ Digest.getSubscribers = function (interval, callback) {
};

Digest.send = function (data, callback) {
var emailsSent = 0;
if (!data || !data.subscribers || !data.subscribers.length) {
return callback();
return callback(null, emailsSent);
}
var now = new Date();

Expand Down Expand Up @@ -131,7 +132,7 @@ Digest.send = function (data, callback) {

return topicObj;
});

emailsSent += 1;
emailer.send('digest', userObj.uid, {
subject: '[' + meta.config.title + '] [[email:digest.subject, ' + (now.getFullYear() + '/' + (now.getMonth() + 1) + '/' + now.getDate()) + ']]',
username: userObj.username,
Expand All @@ -151,6 +152,6 @@ Digest.send = function (data, callback) {
}, next);
},
], function (err) {
callback(err, data.subscribers.length);
callback(err, emailsSent);
});
};

0 comments on commit d70cdf1

Please sign in to comment.