From 2e397c78c405940236056d391d93bd7bdf18dec8 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Mon, 17 Feb 2020 21:09:27 +0530 Subject: [PATCH] FIX: use separate site attribute for single category "top tags" list. And use it only in the single category pages. 38dd184a16f38fed1f011eeb39de580a301b8f4e --- .../discourse/routes/build-topic-route.js.es6 | 6 +++++- .../select-kit/components/tag-drop.js.es6 | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 index e7a8d97ef33..457399f2ebc 100644 --- a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 @@ -67,7 +67,11 @@ function findTopicList(store, tracking, filter, filterParams, extras) { } Session.currentProp("topicList", list); if (list.topic_list && list.topic_list.top_tags) { - Site.currentProp("top_tags", list.topic_list.top_tags); + if (list.filter.startsWith("c/")) { + Site.currentProp("category_top_tags", list.topic_list.top_tags); + } else { + Site.currentProp("top_tags", list.topic_list.top_tags); + } } return list; }); diff --git a/app/assets/javascripts/select-kit/components/tag-drop.js.es6 b/app/assets/javascripts/select-kit/components/tag-drop.js.es6 index fa25372b911..aa877f3e1bc 100644 --- a/app/assets/javascripts/select-kit/components/tag-drop.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-drop.js.es6 @@ -107,7 +107,19 @@ export default ComboBoxComponent.extend(TagsMixin, { return shortcuts; }), - topTags: readOnly("site.top_tags.[]"), + topTags: computed( + "firstCategory", + "secondCategory", + "site.category_top_tags.[]", + "site.top_tags.[]", + function() { + if (this.currentCategory && this.site.category_top_tags) { + return this.site.category_top_tags; + } + + return this.site.top_tags; + } + ), content: computed("topTags.[]", "shortcuts.[]", function() { if (this.sortTagsAlphabetically && this.topTags) {