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