Skip to content

Node.js based forum software built for the modern web

fixes #5770

Julian Lameb9f6145d99d
diff --git a/src/user/digest.js b/src/user/digest.js
index 6226a2234a..ba867c69c3 100644
--- a/src/user/digest.js
+++ b/src/user/digest.js
@@ -72,6 +72,33 @@ Digest.getSubscribers = function (interval, callback) {
function (next) {
db.getSortedSetRange('digest:' + interval + ':uids', 0, -1, next);
},
+ function (subscribers, next) {
+ // If ACP default digest frequency is set, add all users who are not in any of the explicit subscription sorted sets
+ if (!meta.config.dailyDigestFreq || meta.configs.dailyDigestFreq === 'off') {
+ return setImmediate(next, null, subscribers);
+ }
+
+ var digestSets = ['digest:day:uids', 'digest:week:uids', 'digest:month:uids'];
+ db.getSortedSetsMembers(digestSets.concat('users:joindate'), function (err, sets) {
+ if (err) {
+ return next(err);
+ }
+
+ var allUids = sets.pop();
+ // Append those uids from the joindate zset who are not in digest sets
+ allUids.forEach(function (uid) {
+ var append = sets.every(function (set) {
+ return set.indexOf(uid) === -1;
+ });
+
+ if (append) {
+ subscribers.push(uid);
+ }
+ });
+
+ next(null, subscribers);
+ });
+ },
function (subscribers, next) {
plugins.fireHook('filter:digest.subscribers', {
interval: interval,