2018-06-15 23:03:24 +08:00
|
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
|
|
import IncomingEmail from "admin/models/incoming-email";
|
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
import { longDate } from "discourse/lib/formatter";
|
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2016-02-11 05:00:27 +08:00
|
|
|
|
|
|
|
export default Ember.Controller.extend(ModalFunctionality, {
|
|
|
|
@computed("model.date")
|
|
|
|
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)
|
2018-06-15 23:03:24 +08:00
|
|
|
.then(result => this.set("model", result))
|
|
|
|
.catch(error => {
|
|
|
|
this.send("closeModal");
|
|
|
|
popupAjaxError(error);
|
|
|
|
});
|
2016-02-11 05:00:27 +08:00
|
|
|
}
|
|
|
|
});
|