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

32 lines
622 B
JavaScript
Raw Normal View History

2022-03-06 15:18:46 -05:00
import Component from "@ember/component";
import { popupAjaxError } from "discourse/lib/ajax-error";
import computed from "discourse-common/utils/decorators";
2022-03-06 15:18:46 -05:00
export default Component.extend({
tagName: "tr",
@computed("rule.type")
2017-10-03 05:42:07 -04:00
isCategory(type) {
return type === "normal";
2017-10-03 05:42:07 -04:00
},
@computed("rule.type")
2017-10-03 05:42:07 -04:00
isMessage(type) {
return type === "group_message";
2017-10-03 05:42:07 -04:00
},
@computed("rule.type")
2017-10-03 05:42:07 -04:00
isMention(type) {
return type === "group_mention";
2017-10-03 05:42:07 -04:00
},
actions: {
2017-10-03 05:42:07 -04:00
delete(rule) {
rule
.destroyRecord()
.then(() => this.refresh())
.catch(popupAjaxError);
2020-09-04 07:23:28 -04:00
},
},
2017-10-03 05:42:07 -04:00
});