discourse/app/assets/javascripts/admin/addon/components/admin-watched-word.js
Bianca Nenciu f700f3ef00
FEATURE: Support tag and replace in watched words in test modal (#13100)
The modal showed only the matches, without the replacement or tags.
2021-05-21 17:50:24 +03:00

33 lines
758 B
JavaScript

import Component from "@ember/component";
import { equal } from "@ember/object/computed";
import bootbox from "bootbox";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
export default Component.extend({
classNames: ["watched-word"],
isReplace: equal("actionKey", "replace"),
isTag: equal("actionKey", "tag"),
@discourseComputed("word.replacement")
tags(replacement) {
return replacement.split(",");
},
click() {
this.word
.destroy()
.then(() => {
this.action(this.word);
})
.catch((e) => {
bootbox.alert(
I18n.t("generic_error_with_reason", {
error: `http: ${e.status} - ${e.body}`,
})
);
});
},
});