2019-10-24 01:06:54 +08:00
|
|
|
import Controller from "@ember/controller";
|
2016-02-11 05:00:27 +08:00
|
|
|
import IncomingEmail from "admin/models/incoming-email";
|
|
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2016-02-11 05:00:27 +08:00
|
|
|
import { longDate } from "discourse/lib/formatter";
|
2017-03-03 07:37:28 +08:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2016-02-11 05:00:27 +08:00
|
|
|
|
2019-10-24 01:06:54 +08:00
|
|
|
export default Controller.extend(ModalFunctionality, {
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.date")
|
2016-02-11 05:00:27 +08:00
|
|
|
date(d) {
|
|
|
|
return longDate(d);
|
|
|
|
},
|
|
|
|
|
|
|
|
load(id) {
|
|
|
|
return IncomingEmail.find(id).then((result) => this.set("model", result));
|
2017-02-23 01:51:33 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
loadFromBounced(id) {
|
2017-03-03 07:37:28 +08:00
|
|
|
return IncomingEmail.findByBounced(id)
|
|
|
|
.then((result) => this.set("model", result))
|
|
|
|
.catch((error) => {
|
|
|
|
this.send("closeModal");
|
|
|
|
popupAjaxError(error);
|
|
|
|
});
|
2016-02-11 05:00:27 +08:00
|
|
|
},
|
|
|
|
});
|