mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-08 08:32:53 +01:00
Merge branch 'master' of github.com:designcreateplay/NodeBB
This commit is contained in:
@@ -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);
|
||||
|
||||
12
src/user.js
12
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 notifications
|
||||
if (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) {
|
||||
|
||||
Reference in New Issue
Block a user