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

31 lines
586 B
JavaScript
Raw Normal View History

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";
export default Ember.Component.extend({
2018-09-12 16:16:18 +01:00
tagName: "tr",
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
actions: {
2017-10-03 17:42:07 +08:00
delete(rule) {
2018-09-12 16:16:18 +01:00
rule
.destroyRecord()
.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
});