From d70cdf1e2838c6cf88bff5a5334e2f8d278406c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 23 Jan 2018 12:02:43 -0500 Subject: [PATCH] show real emails sent number --- src/user/digest.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/user/digest.js b/src/user/digest.js index dba9c48f16..c08a0afe93 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -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(); @@ -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, @@ -151,6 +152,6 @@ Digest.send = function (data, callback) { }, next); }, ], function (err) { - callback(err, data.subscribers.length); + callback(err, emailsSent); }); };