mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:23:13 +08:00
29 lines
660 B
JavaScript
29 lines
660 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default class AdminWebHooksEditRoute extends DiscourseRoute {
|
|
serialize(model) {
|
|
return { web_hook_id: model.id || "new" };
|
|
}
|
|
|
|
model(params) {
|
|
if (params.web_hook_id === "new") {
|
|
return this.store.createRecord("web-hook");
|
|
}
|
|
|
|
return this.store.find("web-hook", params.web_hook_id);
|
|
}
|
|
|
|
setupController(controller, model) {
|
|
super.setupController(...arguments);
|
|
|
|
if (model.get("isNew")) {
|
|
model.set(
|
|
"web_hook_event_types",
|
|
this.controllerFor("adminWebHooks").defaultEventTypes
|
|
);
|
|
}
|
|
|
|
controller.set("saved", false);
|
|
}
|
|
}
|