Skip to content

Commit

Permalink
fix: sorting when filtering by uid
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Mar 17, 2021
1 parent 98b72ca commit 75553b2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/categories/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,18 @@ 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`));
} else {
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,
Expand Down

0 comments on commit 75553b2

Please sign in to comment.