From 0603bd57df8f8010cc4f608cd14e6ffa4739b49c Mon Sep 17 00:00:00 2001 From: Selase Krakani <849886+s3lase@users.noreply.github.com> Date: Thu, 9 Mar 2023 23:34:08 +0000 Subject: [PATCH] FIX: Ensure `form_template_ids` is defined on new category records (#20610) Navigating to the topic template tab on a new category form resulted in exceptions because the `form_template_ids` property was undefined. This fix sets the `form_template_ids` property on new category records. --- app/assets/javascripts/discourse/app/routes/new-category.js | 1 + .../discourse/tests/acceptance/category-new-test.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/app/assets/javascripts/discourse/app/routes/new-category.js b/app/assets/javascripts/discourse/app/routes/new-category.js index bceca86dac..2fb6237719 100644 --- a/app/assets/javascripts/discourse/app/routes/new-category.js +++ b/app/assets/javascripts/discourse/app/routes/new-category.js @@ -33,6 +33,7 @@ export default DiscourseRoute.extend({ custom_fields: {}, search_priority: SEARCH_PRIORITIES.normal, required_tag_groups: [], + form_template_ids: [], }); }, diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js index e940c23a01..77f4cdd89d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js @@ -22,6 +22,11 @@ acceptance("Category New", function (needs) { await fillIn("input.category-name", "testing"); assert.strictEqual(query(".badge-category").innerText, "testing"); + await click(".edit-category-nav .edit-category-topic-template a"); + assert + .dom(".edit-category-tab-topic-template") + .isVisible("it can switch to topic template tab"); + await click(".edit-category-nav .edit-category-tags a"); await click("button.add-required-tag-group");