mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 19:07:08 +02:00
feat: allow multiple cids for getActiveUsers
This commit is contained in:
@@ -7,10 +7,13 @@ var posts = require('../posts');
|
|||||||
var db = require('../database');
|
var db = require('../database');
|
||||||
|
|
||||||
module.exports = function (Categories) {
|
module.exports = function (Categories) {
|
||||||
Categories.getActiveUsers = function (cid, callback) {
|
Categories.getActiveUsers = function (cids, callback) {
|
||||||
|
if (!Array.isArray(cids)) {
|
||||||
|
cids = [cids];
|
||||||
|
}
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
db.getSortedSetRevRange('cid:' + cid + ':pids', 0, 24, next);
|
db.getSortedSetRevRange(cids.map(cid => 'cid:' + cid + ':pids'), 0, 24, next);
|
||||||
},
|
},
|
||||||
function (pids, next) {
|
function (pids, next) {
|
||||||
posts.getPostsFields(pids, ['uid'], next);
|
posts.getPostsFields(pids, ['uid'], next);
|
||||||
|
|||||||
Reference in New Issue
Block a user