mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
closes #4335
This commit is contained in:
@@ -8,10 +8,16 @@ var sockets = require('../socket.io');
|
||||
module.exports = function(Messaging) {
|
||||
|
||||
Messaging.getUnreadCount = function(uid, callback) {
|
||||
if (!parseInt(uid, 10)) {
|
||||
return callback(null, 0);
|
||||
}
|
||||
db.sortedSetCard('uid:' + uid + ':chat:rooms:unread', callback);
|
||||
};
|
||||
|
||||
Messaging.pushUnreadCount = function(uid) {
|
||||
if (!parseInt(uid, 10)) {
|
||||
return callback(null, 0);
|
||||
}
|
||||
Messaging.getUnreadCount(uid, function(err, unreadCount) {
|
||||
if (err) {
|
||||
return;
|
||||
@@ -24,6 +30,10 @@ module.exports = function(Messaging) {
|
||||
db.sortedSetRemove('uid:' + uid + ':chat:rooms:unread', roomId, callback);
|
||||
};
|
||||
|
||||
Messaging.markAllRead = function(uid, callback) {
|
||||
db.delete('uid:' + uid + ':chat:rooms:unread', callback);
|
||||
};
|
||||
|
||||
Messaging.markUnread = function(uids, roomId, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
|
||||
Reference in New Issue
Block a user