I was interested in that functionality as well, so I developed my own version of it.
It can be found here and already is in nbbpm (can be installed from ACP by searching for nodebb-plugin-category-queue)
It has some basic ACP (list of categories with options to queue new topics from them or not queue), and only works on new topics, not all posts (that is actually by design, as - after all - you have done the work on filtering posts already. It's just that I was looking for only sending new topics to queue)
Save Nested Object or Array Into Topic Data
-
Hi community, I am writing a plugin that I want to keep track of a list of users who have replied to a certain topic.
I wanted to create a list of uids that replied (or object with uid as key and post count inside the topic as value) in the topic data object.
However when I tried to do it like this
plugin.createReplyList = function(topicData) { var replyList = [1,2,3] db.setObjectField('topic:' + topicData.tid, "replyList", replyList); };
I got the below error
node_redis: Deprecated: The HSET command contains a argument of type Array. This is converted to "1,2,3" by using .toString() now and will return an error from v.3.0 on. Please handle this in your code to make sure everything works as you intended it to.
Wonder what would be the correct way to achieve this? Thanks in advance.
-
Why don't you just create the list when you need it by iterating over the posts in a topic?
What do you need this list for? There actually might already be a list for this... let me check.
Edit: ok I was thinking of
Topics.getFollowers(tid, callback);
which corresponds to thetid:[tid]:followers
set. Maybe that could work for you, as most users have it set up so they follow the topic when they reply. However, if that doesn't work, then you probably want to listen to theaction:topic.reply
hook and add users to a set or sorted set that way.function onTopicReply(postData, callback) { var tid = postData.tid; var uid = postData.uid; db.setAdd('topic:tid:' + tid + ':replies', uid, callback); }
-
Keep in mind we already have
'tid:' + tid + ':posters'
It keeps a list of poster uids in that topic sorted by reply count. -
@baris literally saved my day
BTW, is there a way to tell the client side code to refresh the page inside an action hook, sayaction:topic.reply
? -
Client side you can call
ajaxify.refresh()
to refresh the page.