From 284fe89165d3a355dc62833beaf63d1db7bd67f2 Mon Sep 17 00:00:00 2001 From: Kris Date: Tue, 17 Dec 2024 15:17:24 -0500 Subject: [PATCH] UX: show correct message when creating topics is disabled by a tag (#30328) --- .../discourse/app/components/create-topic-button.hbs | 5 +---- .../discourse/app/components/create-topic-button.js | 8 ++++++++ config/locales/client.en.yml | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/create-topic-button.hbs b/app/assets/javascripts/discourse/app/components/create-topic-button.hbs index 1cb14d030e3..1adb871a602 100644 --- a/app/assets/javascripts/discourse/app/components/create-topic-button.hbs +++ b/app/assets/javascripts/discourse/app/components/create-topic-button.hbs @@ -12,10 +12,7 @@ <:tooltip> {{#if @disabled}} - + {{/if}} diff --git a/app/assets/javascripts/discourse/app/components/create-topic-button.js b/app/assets/javascripts/discourse/app/components/create-topic-button.js index 11257c0059e..c0357b24819 100644 --- a/app/assets/javascripts/discourse/app/components/create-topic-button.js +++ b/app/assets/javascripts/discourse/app/components/create-topic-button.js @@ -5,4 +5,12 @@ import { tagName } from "@ember-decorators/component"; export default class CreateTopicButton extends Component { label = "topic.create"; btnClass = "btn-default"; + + get disallowedReason() { + if (this.canCreateTopicOnTag === false) { + return "topic.create_disabled_tag"; + } else if (this.disabled) { + return "topic.create_disabled_category"; + } + } } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 8aca18b910c..1daf18b4af0 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -3275,6 +3275,7 @@ en: other: "%{count} posts in topic" create: "New Topic" create_disabled_category: "You're not allowed to create topics in this category" + create_disabled_tag: "You're not allowed to create topics with this tag" create_long: "Create a new Topic" open_draft: "Open Draft" private_message: "Start a message"