2018-11-29 07:03:50 +08:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
|
|
|
email: null,
|
|
|
|
text: null,
|
|
|
|
elided: null,
|
|
|
|
format: null,
|
2018-12-03 19:51:59 +08:00
|
|
|
loading: null,
|
2018-11-29 07:03:50 +08:00
|
|
|
|
|
|
|
actions: {
|
|
|
|
run() {
|
|
|
|
this.set("loading", true);
|
|
|
|
|
|
|
|
ajax("/admin/email/advanced-test", {
|
|
|
|
type: "POST",
|
|
|
|
data: { email: this.get("email") }
|
|
|
|
})
|
|
|
|
.then(data => {
|
|
|
|
this.setProperties({
|
|
|
|
text: data.text,
|
|
|
|
elided: data.elided,
|
|
|
|
format: data.format
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(popupAjaxError)
|
|
|
|
.finally(() => this.set("loading", false));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|