mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Autotag watched words (#12244)
New topics with be matched against a set of watched words and be tagged accordingly.
This commit is contained in:
@@ -6,6 +6,7 @@ import Component from "@ember/component";
|
||||
import I18n from "I18n";
|
||||
import WatchedWord from "admin/models/watched-word";
|
||||
import bootbox from "bootbox";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { schedule } from "@ember/runloop";
|
||||
|
||||
@@ -15,10 +16,8 @@ export default Component.extend({
|
||||
actionKey: null,
|
||||
showMessage: false,
|
||||
|
||||
@discourseComputed("actionKey")
|
||||
canReplace(actionKey) {
|
||||
return actionKey === "replace";
|
||||
},
|
||||
canReplace: equal("actionKey", "replace"),
|
||||
canTag: equal("actionKey", "tag"),
|
||||
|
||||
@discourseComputed("regularExpressions")
|
||||
placeholderKey(regularExpressions) {
|
||||
@@ -61,7 +60,7 @@ export default Component.extend({
|
||||
|
||||
const watchedWord = WatchedWord.create({
|
||||
word: this.word,
|
||||
replacement: this.canReplace ? this.replacement : null,
|
||||
replacement: this.canReplace || this.canTag ? this.replacement : null,
|
||||
action: this.actionKey,
|
||||
});
|
||||
|
||||
|
||||
@@ -10,6 +10,13 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if canTag}}
|
||||
<div class="watched-word-input">
|
||||
<label for="watched-tag">{{i18n "admin.watched_words.form.tag_label"}}</label>
|
||||
{{text-field id="watched-tag" value=replacement disabled=formSubmitted class="watched-word-input" autocorrect="off" autocapitalize="off" placeholderKey="admin.watched_words.form.tag_placeholder"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{d-button class="btn-default" action=(action "submit") disabled=formSubmitted label="admin.watched_words.form.add"}}
|
||||
|
||||
{{#if showMessage}}
|
||||
|
||||
Reference in New Issue
Block a user