From f85ec961723b6f89ed1e23f43738b63339871352 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 8 Jul 2016 01:26:48 +0300 Subject: [PATCH] small change to new hook --- src/topics/recent.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/topics/recent.js b/src/topics/recent.js index 8440b3e4a6..c6fa7c7425 100644 --- a/src/topics/recent.js +++ b/src/topics/recent.js @@ -66,8 +66,14 @@ module.exports = function(Topics) { callback = callback || function() {}; if (plugins.hasListeners('filter:topics.updateRecent')) { plugins.fireHook('filter:topics.updateRecent', {tid: tid, timestamp: timestamp}, function(err, data) { - if (data && data.tid && data.timestamp) db.sortedSetAdd('topics:recent', data.timestamp, data.tid); - callback(err); + if (err) { + return callback(err); + } + if (data && data.tid && data.timestamp) { + db.sortedSetAdd('topics:recent', data.timestamp, data.tid, callback); + } else { + callback(); + } }); } else { db.sortedSetAdd('topics:recent', timestamp, tid, callback);