Filtering posts by user in a topic
-
I will leave the required database call here in case someone wants to build a plugin that does this.
The posts of a topic are stored in
tid:${tid}:posts
, a users posts are stored inuid:${uid}:posts
. So if you get the intersection of these two sorted sets that will give you the post ids of the user in the topic.const postIdsOfUserInTopic = await db.getSortedSetIntersect({ sets: [`tid:${tid}:posts`, `uid:${uid}:posts`], start: 0, stop: -1, weights: [1, 0], });
-
-
Copyright © 2024 NodeBB | Contributors