FIX: only delete the word/phrase when the 'x' icon is clicked (#13547)

FIX: only delete the word/phrase when the ‘x’ icon is clicked (#13547)

diff --git a/app/assets/javascripts/admin/addon/components/admin-watched-word.js b/app/assets/javascripts/admin/addon/components/admin-watched-word.js
index 8c5fd51..b198ffc 100644
--- a/app/assets/javascripts/admin/addon/components/admin-watched-word.js
+++ b/app/assets/javascripts/admin/addon/components/admin-watched-word.js
@@ -2,6 +2,7 @@ import Component from "@ember/component";
 import { equal } from "@ember/object/computed";
 import bootbox from "bootbox";
 import discourseComputed from "discourse-common/utils/decorators";
+import { action } from "@ember/object";
 import I18n from "I18n";
 
 export default Component.extend({
@@ -16,7 +17,8 @@ export default Component.extend({
     return replacement.split(",");
   },
 
-  click() {
+  @action
+  deleteWord() {
     this.word
       .destroy()
       .then(() => {
diff --git a/app/assets/javascripts/admin/addon/templates/components/admin-watched-word.hbs b/app/assets/javascripts/admin/addon/templates/components/admin-watched-word.hbs
index 53d61a9..31cfd51 100644
--- a/app/assets/javascripts/admin/addon/templates/components/admin-watched-word.hbs
+++ b/app/assets/javascripts/admin/addon/templates/components/admin-watched-word.hbs
@@ -1,4 +1,4 @@
-{{d-icon "times"}} {{word.word}}
+<span role="button" onclick={{action "deleteWord"}} class="delete-word-record">{{d-icon "times"}}</span> {{word.word}}
 {{#if (or isReplace isLink)}}
   &rarr; <span class="replacement">{{word.replacement}}</span>
 {{else if isTag}}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js
index ecc2958..5e40f78 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js
@@ -82,7 +82,7 @@ acceptance("Admin - Watched Words", function (needs) {
       }
     });
 
-    await click("#" + $(word).attr("id"));
+    await click(`#${$(word).attr("id")} .delete-word-record`);
 
     assert.equal(count(".watched-words-list .watched-word"), 2);
   });
diff --git a/app/assets/stylesheets/common/admin/staff_logs.scss b/app/assets/stylesheets/common/admin/staff_logs.scss
index c893a17..3953f08 100644
--- a/app/assets/stylesheets/common/admin/staff_logs.scss
+++ b/app/assets/stylesheets/common/admin/staff_logs.scss
@@ -377,10 +377,10 @@ table.screened-ip-addresses {
   .d-icon {
     margin-right: 0.25em;
     color: var(--primary-medium);
-  }
 
-  &:hover .d-icon {
-    color: var(--danger);
+    &:hover {
+      color: var(--danger);
+    }
   }
 }
 

GitHub sha: 3dda926cb22751beced12b427dd14657b53b6dfe

This commit appears in #13547 which was approved by nbianca and tgxworld. It was merged by techAPJ.