Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit 750ce1f7f8

@ -26,8 +26,6 @@ var async = require('async'),
return callback(err); return callback(err);
} }
db.setAdd('topics:tid', tid);
var slug = tid + '/' + utils.slugify(title), var slug = tid + '/' + utils.slugify(title),
timestamp = Date.now(); timestamp = Date.now();
@ -48,6 +46,8 @@ var async = require('async'),
if(err) { if(err) {
return callback(err); return callback(err);
} }
db.setAdd('topics:tid', tid);
db.searchIndex('topic', title, tid); db.searchIndex('topic', title, tid);
user.addTopicIdToUser(uid, tid, timestamp); user.addTopicIdToUser(uid, tid, timestamp);

@ -1017,26 +1017,30 @@ var bcrypt = require('bcryptjs'),
async.parallel({ async.parallel({
unread: function(next) { 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' : ''; notif_data.readClass = !notif_data.read ? 'label-warning' : '';
}, next); }, next);
}, },
read: function(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) { }, function(err, notifications) {
if(err) {
return calback(err);
}
// Limit the number of notifications to `maxNotifs`, prioritising unread notifications // Limit the number of notifications to `maxNotifs`, prioritising unread notifications
if (notifications.read.length + notifications.unread.length > maxNotifs) { if (notifications.read.length + notifications.unread.length > maxNotifs) {
notifications.read.length = maxNotifs - notifications.unread.length; notifications.read.length = maxNotifs - notifications.unread.length;
} }
callback(err, notifications); callback(null, notifications);
}); });
}, },
getAll: function(uid, limit, before, callback) { getAll: function(uid, limit, before, callback) {
var now = new Date(); var now = new Date();
if (!limit || parseInt(limit,10) <= 0) { if (!limit || parseInt(limit, 10) <= 0) {
limit = 25; limit = 25;
} }
if (before) { if (before) {

Loading…
Cancel
Save