2019-10-24 01:06:54 +08:00
|
|
|
import Controller from "@ember/controller";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { action } from "@ember/object";
|
2018-11-29 07:03:50 +08:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
|
2024-10-15 01:09:25 +08:00
|
|
|
// eslint-disable-next-line ember/no-test-import-export
|
2023-03-15 17:42:12 +08:00
|
|
|
export default class AdminEmailAdvancedTestController extends Controller {
|
|
|
|
email = null;
|
|
|
|
text = null;
|
|
|
|
elided = null;
|
|
|
|
format = null;
|
|
|
|
loading = null;
|
2018-11-29 07:03:50 +08:00
|
|
|
|
2023-03-15 17:42:12 +08:00
|
|
|
@action
|
|
|
|
run() {
|
|
|
|
this.set("loading", true);
|
2018-11-29 07:03:50 +08:00
|
|
|
|
2023-03-15 17:42:12 +08: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-29 07:03:50 +08:00
|
|
|
})
|
2023-03-15 17:42:12 +08:00
|
|
|
.catch(popupAjaxError)
|
|
|
|
.finally(() => this.set("loading", false));
|
|
|
|
}
|
|
|
|
}
|