DEV: Allow HTML in grant admin dialog (#20133)

In a private plugin, we need to show an error message containing HTML
when the Grant Admin action fails. This change introduces a new flag
(`html_message: true`) that when used will allow the dialog to render
the HTML tags in the error message correctly.
This commit is contained in:
Penar Musaraj
2023-02-02 09:09:25 -05:00
committed by GitHub
parent 54f165beae
commit 6bbf832400
2 changed files with 41 additions and 2 deletions

View File

@ -232,7 +232,14 @@ export default Controller.extend(CanCheckEmails, {
queryParams: { nonce },
});
} else {
popupAjaxError(error);
const htmlMessage = error.jqXHR?.responseJSON.html_message;
if (htmlMessage) {
this.dialog.alert({
message: htmlSafe(error.jqXHR?.responseJSON.error),
});
} else {
popupAjaxError(error);
}
}
});
},