From 41d10d18a1721904346f8b2d69dbcbbc86c6ceb1 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 21 Jan 2016 18:57:38 +0200 Subject: [PATCH] disable related topics if its set to 0 --- src/topics/tags.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/topics/tags.js b/src/topics/tags.js index 48ef3dba41..527913557a 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -327,12 +327,13 @@ module.exports = function(Topics) { return plugins.fireHook('filter:topic.getRelatedTopics', {topic: topicData, uid: uid}, callback); } - var maximumTopics = parseInt(meta.config.maximumRelatedTopics, 10) || 5; - - if (!topicData.tags.length || maximumTopics === 0) { + var maximumTopics = parseInt(meta.config.maximumRelatedTopics, 10); + if (maximumTopics === 0 || !topicData.tags.length) { return callback(null, []); } + maximumTopics = maximumTopics || 5; + async.waterfall([ function (next) { async.map(topicData.tags, function (tag, next) {