support for array in getTopicIds

v1.18.x
barisusakli 9 years ago
parent 06cc761a7a
commit 4440865ec4

@ -1,11 +1,11 @@
'use strict';
var async = require('async'),
db = require('../database'),
user = require('../user'),
topics = require('../topics'),
plugins = require('../plugins'),
privileges = require('../privileges');
var async = require('async');
var db = require('../database');
var topics = require('../topics');
var plugins = require('../plugins');
var privileges = require('../privileges');
module.exports = function(Categories) {
@ -60,10 +60,18 @@ module.exports = function(Categories) {
};
Categories.getTopicIds = function(set, reverse, start, stop, callback) {
if (reverse) {
db.getSortedSetRevRange(set, start, stop, callback);
if (Array.isArray(set)) {
if (reverse) {
db.getSortedSetRevUnion(set, start, stop, callback);
} else {
db.getSortedSetUnion(set, start, stop, callback);
}
} else {
db.getSortedSetRange(set, start, stop, callback);
if (reverse) {
db.getSortedSetRevRange(set, start, stop, callback);
} else {
db.getSortedSetRange(set, start, stop, callback);
}
}
};

@ -112,7 +112,8 @@ SocketCategories.loadMore = function(socket, data, callback) {
start: start,
stop: stop,
uid: socket.uid,
targetUid: results.targetUid
targetUid: results.targetUid,
settings: results.settings
}, function(err, data) {
if (err) {
return callback(err);

Loading…
Cancel
Save