2019-10-24 01:06:54 +08:00
|
|
|
import Controller from "@ember/controller";
|
2016-06-16 01:49:57 +08:00
|
|
|
import I18n from "I18n";
|
2020-08-27 00:57:13 +08:00
|
|
|
import bootbox from "bootbox";
|
2016-06-16 01:49:57 +08:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
|
2019-10-24 01:06:54 +08:00
|
|
|
export default Controller.extend({
|
2016-06-16 01:49:57 +08:00
|
|
|
actions: {
|
|
|
|
destroy(webhook) {
|
|
|
|
return bootbox.confirm(
|
|
|
|
I18n.t("admin.web_hooks.delete_confirm"),
|
|
|
|
I18n.t("no_value"),
|
|
|
|
I18n.t("yes_value"),
|
|
|
|
(result) => {
|
|
|
|
if (result) {
|
|
|
|
webhook
|
|
|
|
.destroyRecord()
|
|
|
|
.then(() => {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.removeObject(webhook);
|
2016-06-16 01:49:57 +08:00
|
|
|
})
|
|
|
|
.catch(popupAjaxError);
|
2018-06-15 23:03:24 +08:00
|
|
|
}
|
2016-06-16 01:49:57 +08:00
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
loadMore() {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.loadMore();
|
2016-06-16 01:49:57 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|