diff --git a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 index e3d2e89a8b7..b0dfc941ca1 100644 --- a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 @@ -63,9 +63,15 @@ export default (filter, params) => { setupController(controller, model) { const topics = this.get('topics'), - periodId = topics.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : ''); + periodId = topics.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : ''), + canCreateTopic = topics.get('can_create_topic'), + canCreateTopicOnCategory = model.get('permission') === Discourse.PermissionType.FULL; - this.controllerFor('navigation/category').set('canCreateTopic', topics.get('can_create_topic')); + this.controllerFor('navigation/category').setProperties({ + canCreateTopicOnCategory: canCreateTopicOnCategory, + cannotCreateTopicOnCategory: !canCreateTopicOnCategory, + canCreateTopic: canCreateTopic + }); this.controllerFor('discovery/topics').setProperties({ model: topics, category: model, @@ -74,7 +80,9 @@ export default (filter, params) => { noSubcategories: params && !!params.no_subcategories, order: topics.get('params.order'), ascending: topics.get('params.ascending'), - expandAllPinned: true + expandAllPinned: true, + canCreateTopic: canCreateTopic, + canCreateTopicOnCategory: canCreateTopicOnCategory }); this.searchService.set('searchContext', model.get('searchContext')); diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/discovery/topics.hbs index f3e452a4ab0..9ed3a83d177 100644 --- a/app/assets/javascripts/discourse/templates/discovery/topics.hbs +++ b/app/assets/javascripts/discourse/templates/discovery/topics.hbs @@ -67,7 +67,7 @@

{{footerMessage}} - {{#if model.can_create_topic}}{{i18n 'topic.suggest_create_topic'}}{{/if}} + {{#if canCreateTopicOnCategory}}{{i18n 'topic.suggest_create_topic'}}{{/if}}

{{else}} {{#if top}} diff --git a/app/assets/javascripts/discourse/templates/navigation/category.hbs b/app/assets/javascripts/discourse/templates/navigation/category.hbs index 7d874edf175..428abe827b4 100644 --- a/app/assets/javascripts/discourse/templates/navigation/category.hbs +++ b/app/assets/javascripts/discourse/templates/navigation/category.hbs @@ -11,7 +11,12 @@ {{/if}} {{#if canCreateTopic}} - {{d-button id="create-topic" class="btn-default" action="createTopic" icon="plus" label="topic.create"}} + {{d-button id="create-topic" + class="btn-default" + action="createTopic" + icon="plus" + label="topic.create" + disabled=cannotCreateTopicOnCategory}} {{/if}} {{#if canEditCategory}}