discourse-chat-integration/assets/javascripts/admin/components/rule-row.js

28 lines
629 B
JavaScript
Raw Normal View History

2023-01-23 13:30:48 -05:00
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { popupAjaxError } from "discourse/lib/ajax-error";
2023-01-23 13:30:48 -05:00
import { inject as service } from "@ember/service";
export default class RuleRow extends Component {
@service siteSettings;
2023-01-23 13:30:48 -05:00
get isCategory() {
return this.args.rule.type === "normal";
}
2023-01-23 13:30:48 -05:00
get isMessage() {
return this.args.rule.type === "group_message";
}
2023-01-23 13:30:48 -05:00
get isMention() {
return this.args.rule.type === "group_mention";
}
2023-01-23 13:30:48 -05:00
@action
delete(rule) {
rule
.destroyRecord()
.then(() => this.args.refresh())
.catch(popupAjaxError);
}
}