From 4440865ec41a0d16b8a080b7dba9f8e53de5aea9 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 27 Jan 2016 00:05:19 +0200 Subject: [PATCH] support for array in getTopicIds --- src/categories/topics.js | 26 +++++++++++++++++--------- src/socket.io/categories.js | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/categories/topics.js b/src/categories/topics.js index 466e413208..07a7d99596 100644 --- a/src/categories/topics.js +++ b/src/categories/topics.js @@ -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); + } } }; diff --git a/src/socket.io/categories.js b/src/socket.io/categories.js index f9b8f0e3fc..736d534f82 100644 --- a/src/socket.io/categories.js +++ b/src/socket.io/categories.js @@ -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);