Skip to content

Node.js based forum software built for the modern web

small change to new hook

barisusaklif85ec961723b
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);