From 9b593435b69110fe36976e5fc92d9aed8b5016ce Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Tue, 3 Nov 2020 11:29:58 +0530 Subject: [PATCH] FIX: hide 'category read only banner' in categories list page. (#11072) Previously, while navigating away from single category page to categories list page "category read only" banner is not hiding automatically. --- .../javascripts/discourse/app/controllers/discovery.js | 6 +++++- .../javascripts/discourse/app/templates/discovery.hbs | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/discovery.js b/app/assets/javascripts/discourse/app/controllers/discovery.js index e74d8b2de8d..c50bca76d3e 100644 --- a/app/assets/javascripts/discourse/app/controllers/discovery.js +++ b/app/assets/javascripts/discourse/app/controllers/discovery.js @@ -1,4 +1,4 @@ -import { alias, not } from "@ember/object/computed"; +import { alias, not, equal } from "@ember/object/computed"; import Controller, { inject as controller } from "@ember/controller"; import DiscourseURL from "discourse/lib/url"; import Category from "discourse/models/category"; @@ -10,6 +10,10 @@ export default Controller.extend({ navigationCategory: controller("navigation/category"), application: controller(), router: service(), + viewingCategoriesList: equal( + "router.currentRouteName", + "discovery.categories" + ), loading: false, diff --git a/app/assets/javascripts/discourse/app/templates/discovery.hbs b/app/assets/javascripts/discourse/app/templates/discovery.hbs index 33c6190c78e..63588861076 100644 --- a/app/assets/javascripts/discourse/app/templates/discovery.hbs +++ b/app/assets/javascripts/discourse/app/templates/discovery.hbs @@ -3,7 +3,9 @@ {{else}}
{{discourse-banner user=currentUser banner=site.banner}} - {{category-read-only-banner category=category readOnly=navigationCategory.cannotCreateTopicOnCategory}} + {{#unless viewingCategoriesList}} + {{category-read-only-banner category=category readOnly=navigationCategory.cannotCreateTopicOnCategory}} + {{/unless}}