discourse/app/assets/javascripts/admin/addon/controllers/modals/admin-incoming-email.js
David Taylor c190994046
DEV: Update admin modal controllers to native class syntax (#20685)
This commit was generated using the ember-native-class-codemod along with a handful of manual updates
2023-03-15 17:39:33 +00:00

29 lines
850 B
JavaScript

import Controller from "@ember/controller";
import IncomingEmail from "admin/models/incoming-email";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import discourseComputed from "discourse-common/utils/decorators";
import { longDate } from "discourse/lib/formatter";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default class AdminIncomingEmailController extends Controller.extend(
ModalFunctionality
) {
@discourseComputed("model.date")
date(d) {
return longDate(d);
}
load(id) {
return IncomingEmail.find(id).then((result) => this.set("model", result));
}
loadFromBounced(id) {
return IncomingEmail.findByBounced(id)
.then((result) => this.set("model", result))
.catch((error) => {
this.send("closeModal");
popupAjaxError(error);
});
}
}