2019-10-23 13:06:54 -04:00
|
|
|
import Controller from "@ember/controller";
|
2018-11-28 18:03:50 -05:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
|
2019-10-23 13:06:54 -04:00
|
|
|
export default Controller.extend({
|
2018-11-28 18:03:50 -05:00
|
|
|
email: null,
|
|
|
|
text: null,
|
|
|
|
elided: null,
|
|
|
|
format: null,
|
2018-12-03 06:51:59 -05:00
|
|
|
loading: null,
|
2018-11-28 18:03:50 -05:00
|
|
|
|
|
|
|
actions: {
|
|
|
|
run() {
|
|
|
|
this.set("loading", true);
|
|
|
|
|
|
|
|
ajax("/admin/email/advanced-test", {
|
|
|
|
type: "POST",
|
2019-05-27 04:15:39 -04:00
|
|
|
data: { email: this.email }
|
2018-11-28 18:03:50 -05:00
|
|
|
})
|
|
|
|
.then(data => {
|
|
|
|
this.setProperties({
|
|
|
|
text: data.text,
|
|
|
|
elided: data.elided,
|
|
|
|
format: data.format
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(popupAjaxError)
|
|
|
|
.finally(() => this.set("loading", false));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|