From fe3fbb71970eca5dd97c8a24c2546ed7bf7fc1a2 Mon Sep 17 00:00:00 2001 From: Timothy Fike Date: Thu, 7 Jul 2016 17:17:17 -0400 Subject: [PATCH] filter:topics.updateRecent https://community.nodebb.org/topic/9165/prevent-specific-category-from-showing-in-recent --- src/topics/recent.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/topics/recent.js b/src/topics/recent.js index 7139f58991..f2961f9b22 100644 --- a/src/topics/recent.js +++ b/src/topics/recent.js @@ -4,6 +4,7 @@ var async = require('async'); var db = require('../database'); +var plugins = require('../plugins'); module.exports = function(Topics) { var terms = { @@ -63,6 +64,10 @@ module.exports = function(Topics) { Topics.updateRecent = function(tid, timestamp, callback) { callback = callback || function() {}; - db.sortedSetAdd('topics:recent', timestamp, tid, callback); + if (plugins.hasListeners('filter:topics.updateRecent')) { + plugins.fireHook('filter:topics.updateRecent', {tid: tid, timestamp: timestamp}, callback); + } else { + db.sortedSetAdd('topics:recent', timestamp, tid, callback); + } }; };