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

This commit is contained in:
Arpit Jalan 2021-06-28 15:14:18 +05:30 committed by GitHub
parent 6be4699954
commit 3dda926cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

View File

@ -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(() => {

View File

@ -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}}

View File

@ -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);
});

View File

@ -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);
}
}
}