mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
chat teaser
This commit is contained in:
@@ -253,6 +253,22 @@ var db = require('./database'),
|
||||
},
|
||||
users: function(next) {
|
||||
user.getMultipleUserFields(uids, ['uid', 'username', 'picture', 'status'] , next);
|
||||
},
|
||||
chatTeasers: function(next) {
|
||||
var teasers = [];
|
||||
async.each(uids, function(fromuid, next) {
|
||||
Messaging.getMessages({
|
||||
fromuid: fromuid,
|
||||
touid: uid,
|
||||
isNew: false,
|
||||
count: 1
|
||||
}, function(err, teaser) {
|
||||
teasers.push(teaser[0]);
|
||||
next(err);
|
||||
});
|
||||
}, function(err) {
|
||||
next(err, teasers);
|
||||
});
|
||||
}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
@@ -277,6 +293,7 @@ var db = require('./database'),
|
||||
if (user) {
|
||||
user.unread = results.unread[index];
|
||||
user.status = sockets.isUserOnline(user.uid) ? user.status : 'offline';
|
||||
user.chatTeaser = results.chatTeasers[index];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user