2023-03-15 05:42:12 -04:00
|
|
|
import { action } from "@ember/object";
|
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";
|
|
|
|
|
2023-03-15 05:42:12 -04:00
|
|
|
export default class AdminEmailAdvancedTestController extends Controller {
|
|
|
|
email = null;
|
|
|
|
text = null;
|
|
|
|
elided = null;
|
|
|
|
format = null;
|
|
|
|
loading = null;
|
2018-11-28 18:03:50 -05:00
|
|
|
|
2023-03-15 05:42:12 -04:00
|
|
|
@action
|
|
|
|
run() {
|
|
|
|
this.set("loading", true);
|
2018-11-28 18:03:50 -05:00
|
|
|
|
2023-03-15 05:42:12 -04:00
|
|
|
ajax("/admin/email/advanced-test", {
|
|
|
|
type: "POST",
|
|
|
|
data: { email: this.email },
|
|
|
|
})
|
|
|
|
.then((data) => {
|
|
|
|
this.setProperties({
|
|
|
|
text: data.text,
|
|
|
|
elided: data.elided,
|
|
|
|
format: data.format,
|
|
|
|
});
|
2018-11-28 18:03:50 -05:00
|
|
|
})
|
2023-03-15 05:42:12 -04:00
|
|
|
.catch(popupAjaxError)
|
|
|
|
.finally(() => this.set("loading", false));
|
|
|
|
}
|
|
|
|
}
|