From 75553b246ca1596cb1e000377e98ca0ab3407504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 17 Mar 2021 13:14:55 -0400 Subject: [PATCH] fix: sorting when filtering by uid --- src/categories/topics.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/categories/topics.js b/src/categories/topics.js index b24bc6c757..33097b6fe8 100644 --- a/src/categories/topics.js +++ b/src/categories/topics.js @@ -101,10 +101,6 @@ module.exports = function (Categories) { set = `cid:${cid}:tids:votes`; } - if (data.targetUid) { - set = `cid:${cid}:uid:${data.targetUid}:tids`; - } - if (data.tag) { if (Array.isArray(data.tag)) { set = [set].concat(data.tag.map(tag => `tag:${tag}:topics`)); @@ -112,6 +108,11 @@ module.exports = function (Categories) { set = [set, `tag:${data.tag}:topics`]; } } + + if (data.targetUid) { + set = (Array.isArray(set) ? set : [set]).concat([`cid:${cid}:uid:${data.targetUid}:tids`]); + } + const result = await plugins.hooks.fire('filter:categories.buildTopicsSortedSet', { set: set, data: data,