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