Skip to content

A platform for community discussion. Free, open, simple.

FIX: Category Topic Title Placeholder not working with simplified category editor (#38627)

Bannon Tannerf5fcccf24670
diff --git a/frontend/discourse/app/components/category-topic-template-editor.gjs b/frontend/discourse/app/components/category-topic-template-editor.gjs
index 2f8bf090954..0bc4c78b556 100644
--- a/frontend/discourse/app/components/category-topic-template-editor.gjs
+++ b/frontend/discourse/app/components/category-topic-template-editor.gjs
@@ -89,8 +89,7 @@ export default class CategoryTopicTemplateEditor extends Component {
}
@action
- handleTopicTitlePlaceholderChange(event) {
- const value = event.target.value;
+ handleTopicTitlePlaceholderChange(value) {
this.topicTitlePlaceholder = value;
if (this.args.onChange) {
this.args.onChange("topic_title_placeholder", value);
@@ -119,7 +118,7 @@ export default class CategoryTopicTemplateEditor extends Component {
@value={{this.topicTitlePlaceholder}}
@id="category-topic-title-placeholder"
@placeholderKey="category.topic_title_placeholder_placeholder"
- @change={{this.handleTopicTitlePlaceholderChange}}
+ @onChange={{this.handleTopicTitlePlaceholderChange}}
/>
</div>
{{#if this.siteSettings.enable_form_templates}}
diff --git a/spec/system/edit_category_topic_template_spec.rb b/spec/system/edit_category_topic_template_spec.rb
index 0213afc82ce..a3b216920b0 100644
--- a/spec/system/edit_category_topic_template_spec.rb
+++ b/spec/system/edit_category_topic_template_spec.rb
@@ -6,11 +6,31 @@ describe "Edit category topic template", type: :system do
before { sign_in admin }
- it "saves and displays a custom topic title placeholder" do
- visit "/c/#{category.slug}/edit/topic-template"
- find("#category-topic-title-placeholder").fill_in(with: "Describe your issue briefly")
- find("#save-category").click
+ let(:changes_banner) { PageObjects::Components::AdminChangesBanner.new }
- expect(category.reload.topic_title_placeholder).to eq("Describe your issue briefly")
+ context "with simplified category creation" do
+ before { SiteSetting.enable_simplified_category_creation = true }
+
+ it "saves and displays a custom topic title placeholder" do
+ visit "/c/#{category.slug}/edit/topic-template"
+ find("#category-topic-title-placeholder").fill_in(with: "Describe your issue briefly")
+ expect(changes_banner).to be_visible
+ changes_banner.click_save
+
+ expect(category.reload.topic_title_placeholder).to eq("Describe your issue briefly")
+ end
+ end
+
+ context "with legacy category editing" do
+ it "saves and displays a custom topic title placeholder" do
+ visit "/c/#{category.slug}/edit/topic-template"
+ find("#category-topic-title-placeholder").fill_in(with: "Describe your issue briefly")
+
+ # sleep to account for debounce
+ sleep 0.6
+ find("#save-category").click
+
+ expect(category.reload.topic_title_placeholder).to eq("Describe your issue briefly")
+ end
end
end