A platform for community discussion. Free, open, simple.
UX: limit "outputs HTML" watched word option to replacements (#28063)
Renato Atilio75e4b8f3307a
diff --git a/app/assets/javascripts/admin/addon/components/watched-word-form.hbs b/app/assets/javascripts/admin/addon/components/watched-word-form.hbsindex 1570bd74caf..6375e94dd42 100644--- a/app/assets/javascripts/admin/addon/components/watched-word-form.hbs+++ b/app/assets/javascripts/admin/addon/components/watched-word-form.hbs@@ -75,19 +75,21 @@</label></div>-<div class="watched-word-input">- <label for="watched-html">{{i18n- "admin.watched_words.form.html_label"- }}</label>- <label class="html-checkbox checkbox-label">- <Input- @type="checkbox"- @checked={{this.isHtml}}- disabled={{this.formSubmitted}}- />- {{i18n "admin.watched_words.form.html_description"}}- </label>-</div>+{{#if this.canReplace}}+ <div class="watched-word-input">+ <label for="watched-html">{{i18n+ "admin.watched_words.form.html_label"+ }}</label>+ <label class="html-checkbox checkbox-label">+ <Input+ @type="checkbox"+ @checked={{this.isHtml}}+ disabled={{this.formSubmitted}}+ />+ {{i18n "admin.watched_words.form.html_description"}}+ </label>+ </div>+{{/if}}<DButton@action={{this.submitForm}}diff --git a/spec/system/admin_watched_words_spec.rb b/spec/system/admin_watched_words_spec.rbindex 500ff9d1932..1eb14e1f04c 100644--- a/spec/system/admin_watched_words_spec.rb+++ b/spec/system/admin_watched_words_spec.rb@@ -24,4 +24,12 @@ describe "Admin Watched Words", type: :system, js: true doexpect(ww_page).to have_error("Word is too long (maximum is 100 characters)")end++ it "shows the 'outputs HTML' option when action=replace" do+ ww_page.visit+ expect(ww_page).not_to have_text(I18n.t("admin_js.admin.watched_words.form.html_description"))++ ww_page.visit(action: "replace")+ expect(ww_page).to have_text(I18n.t("admin_js.admin.watched_words.form.html_description"))+ endenddiff --git a/spec/system/page_objects/pages/admin_watched_words.rb b/spec/system/page_objects/pages/admin_watched_words.rbindex 2c61f992182..c30c0ab735f 100644--- a/spec/system/page_objects/pages/admin_watched_words.rb+++ b/spec/system/page_objects/pages/admin_watched_words.rb@@ -3,8 +3,8 @@module PageObjectsmodule Pagesclass AdminWatchedWords < PageObjects::Pages::Base- def visit- page.visit "admin/customize/watched_words"+ def visit(action: "block")+ page.visit "admin/customize/watched_words/action/#{action}"selfend