2023-01-23 13:30:48 -05:00
|
|
|
import { action } from "@ember/object";
|
|
|
|
import Component from "@glimmer/component";
|
2018-09-12 11:16:18 -04:00
|
|
|
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;
|
2017-07-18 11:17:03 -04:00
|
|
|
|
2023-01-23 13:30:48 -05:00
|
|
|
get isCategory() {
|
|
|
|
return this.args.rule.type === "normal";
|
|
|
|
}
|
2017-07-18 11:17:03 -04:00
|
|
|
|
2023-01-23 13:30:48 -05:00
|
|
|
get isMessage() {
|
|
|
|
return this.args.rule.type === "group_message";
|
|
|
|
}
|
2017-08-01 15:12:42 -04:00
|
|
|
|
2023-01-23 13:30:48 -05:00
|
|
|
get isMention() {
|
|
|
|
return this.args.rule.type === "group_mention";
|
|
|
|
}
|
2017-08-01 15:12:42 -04:00
|
|
|
|
2023-01-23 13:30:48 -05:00
|
|
|
@action
|
|
|
|
delete(rule) {
|
|
|
|
rule
|
|
|
|
.destroyRecord()
|
|
|
|
.then(() => this.args.refresh())
|
|
|
|
.catch(popupAjaxError);
|
|
|
|
}
|
|
|
|
}
|