2018-09-12 11:16:18 -04:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
2017-07-18 11:17:03 -04:00
|
|
|
|
|
|
|
export default Ember.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
|
|
|
edit() {
|
2018-09-12 11:16:18 -04:00
|
|
|
this.sendAction("edit", this.get("rule"));
|
2017-07-18 11:17:03 -04:00
|
|
|
},
|
2017-10-03 05:42:07 -04:00
|
|
|
|
|
|
|
delete(rule) {
|
2018-09-12 11:16:18 -04:00
|
|
|
rule
|
|
|
|
.destroyRecord()
|
|
|
|
.then(() => {
|
|
|
|
this.send("refresh");
|
|
|
|
})
|
|
|
|
.catch(popupAjaxError);
|
2017-07-18 11:17:03 -04:00
|
|
|
},
|
2017-10-03 05:42:07 -04:00
|
|
|
|
|
|
|
refresh() {
|
2018-09-12 11:16:18 -04:00
|
|
|
this.sendAction("refresh");
|
2017-07-18 11:17:03 -04:00
|
|
|
}
|
|
|
|
}
|
2017-10-03 05:42:07 -04:00
|
|
|
});
|