Node.js based forum software built for the modern web
fixed read notifications
Baris Soner Usaklice4896f2c5d2
diff --git a/src/topics.js b/src/topics.jsindex 6df21b9f27..ebea340719 100644--- a/src/topics.js+++ b/src/topics.js@@ -26,8 +26,6 @@ var async = require('async'),return callback(err);}- db.setAdd('topics:tid', tid);-var slug = tid + '/' + utils.slugify(title),timestamp = Date.now();@@ -48,6 +46,8 @@ var async = require('async'),if(err) {return callback(err);}++ db.setAdd('topics:tid', tid);db.searchIndex('topic', title, tid);user.addTopicIdToUser(uid, tid, timestamp);diff --git a/src/user.js b/src/user.jsindex 7d3703c4c8..1b8a17069a 100644--- a/src/user.js+++ b/src/user.js@@ -1017,26 +1017,30 @@ var bcrypt = require('bcryptjs'),async.parallel({unread: function(next) {- getNotifications('uid:' + uid + ':notifications:unread', 0, 10, function(notif_data) {+ getNotifications('uid:' + uid + ':notifications:unread', 0, 9, function(notif_data) {notif_data.readClass = !notif_data.read ? 'label-warning' : '';}, next);},read: function(next) {- getNotifications('uid:' + uid + 'notifications:read', 0, 10, null, next);+ getNotifications('uid:' + uid + ':notifications:read', 0, 9, null, next);}}, function(err, notifications) {+ if(err) {+ return calback(err);+ }+// Limit the number of notifications to `maxNotifs`, prioritising unread notificationsif (notifications.read.length + notifications.unread.length > maxNotifs) {notifications.read.length = maxNotifs - notifications.unread.length;}- callback(err, notifications);+ callback(null, notifications);});},getAll: function(uid, limit, before, callback) {var now = new Date();- if (!limit || parseInt(limit,10) <= 0) {+ if (!limit || parseInt(limit, 10) <= 0) {limit = 25;}if (before) {