mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
Implement favourite tooltip to show who favourited a post
This commit is contained in:
@@ -115,4 +115,23 @@ var db = require('./database'),
|
||||
}
|
||||
};
|
||||
|
||||
Favourites.getFavouritedUidsByPids = function (pids, callback) {
|
||||
//Might as well take the method above this as an example
|
||||
var loaded = 0;
|
||||
var data = {};
|
||||
|
||||
for (var i = 0, ii = pids.length; i < ii; i++) {
|
||||
(function (post_id) {
|
||||
db.getSetMembers('pid:' + post_id + ':users_favourited', function(err, uids) {
|
||||
data[post_id] = uids;
|
||||
loaded++;
|
||||
if (loaded === pids.length) {
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
}(pids[i]));
|
||||
}
|
||||
//Literally
|
||||
};
|
||||
|
||||
}(exports));
|
||||
Reference in New Issue
Block a user