2018-09-12 16:16:18 +01: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 16:17:03 +01:00
|
|
|
|
|
|
|
|
export default Ember.Component.extend({
|
2018-09-12 16:16:18 +01:00
|
|
|
tagName: "tr",
|
2017-07-18 16:17:03 +01:00
|
|
|
|
2018-09-12 16:16:18 +01:00
|
|
|
@computed("rule.type")
|
2017-10-03 17:42:07 +08:00
|
|
|
isCategory(type) {
|
2018-09-12 16:16:18 +01:00
|
|
|
return type === "normal";
|
2017-10-03 17:42:07 +08:00
|
|
|
},
|
2017-08-01 20:12:42 +01:00
|
|
|
|
2018-09-12 16:16:18 +01:00
|
|
|
@computed("rule.type")
|
2017-10-03 17:42:07 +08:00
|
|
|
isMessage(type) {
|
2018-09-12 16:16:18 +01:00
|
|
|
return type === "group_message";
|
2017-10-03 17:42:07 +08:00
|
|
|
},
|
2017-08-01 20:12:42 +01:00
|
|
|
|
2018-09-12 16:16:18 +01:00
|
|
|
@computed("rule.type")
|
2017-10-03 17:42:07 +08:00
|
|
|
isMention(type) {
|
2018-09-12 16:16:18 +01:00
|
|
|
return type === "group_mention";
|
2017-10-03 17:42:07 +08:00
|
|
|
},
|
2017-08-01 20:12:42 +01:00
|
|
|
|
2017-07-18 16:17:03 +01:00
|
|
|
actions: {
|
2017-10-03 17:42:07 +08:00
|
|
|
delete(rule) {
|
2018-09-12 16:16:18 +01:00
|
|
|
rule
|
|
|
|
|
.destroyRecord()
|
2019-03-20 11:57:07 +01:00
|
|
|
.then(() => this.refresh())
|
2018-09-12 16:16:18 +01:00
|
|
|
.catch(popupAjaxError);
|
2020-09-04 13:23:28 +02:00
|
|
|
},
|
|
|
|
|
},
|
2017-10-03 17:42:07 +08:00
|
|
|
});
|