Skip to content

Node.js based forum software built for the modern web

Skipping digest sending if no notifs and no new topics, #2455

Julian Lama31525c79f12
diff --git a/src/user/digest.js b/src/user/digest.js
index 6c3adba7f7..a253ae62af 100644
--- a/src/user/digest.js
+++ b/src/user/digest.js
@@ -84,6 +84,11 @@ module.exports = (function(Digest) {
notifications = notifications.filter(Boolean);
+ // If there are no notifications and no new topics, don't bother sending a digest
+ if (!notifications.length && !data.topics.topics.length) {
+ return next();
+ }
+
for(var i=0; i<notifications.length; ++i) {
if (notifications[i].image.indexOf('http') !== 0) {
notifications[i].image = nconf.get('url') + notifications[i].image;