Skip to content

A platform for community discussion. Free, open, simple.

DEV: Do not re-throw in popupAjaxError (#13462)

Jarek Radoszfe5923da06c2
diff --git a/app/assets/javascripts/discourse/app/lib/ajax-error.js b/app/assets/javascripts/discourse/app/lib/ajax-error.js
index 0f3feba41ca..4796e627d71 100644
--- a/app/assets/javascripts/discourse/app/lib/ajax-error.js
+++ b/app/assets/javascripts/discourse/app/lib/ajax-error.js
@@ -64,13 +64,5 @@ export function throwAjaxError(undoCallback) {
}
export function popupAjaxError(error) {
- if (error && error._discourse_displayed) {
- return;
- }
bootbox.alert(extractError(error));
-
- error._discourse_displayed = true;
-
- // We re-throw in a catch to not swallow the exception
- throw error;
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
index 7cdbae5745d..f021f0b55eb 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
@@ -333,38 +333,38 @@ acceptance(
}
);
-// acceptance(
-// "Managing Group Email Settings - SMTP and IMAP Enabled - Email Test Invalid",
-// function (needs) {
-// needs.user();
-// needs.settings({ enable_smtp: true, enable_imap: true });
-
-// needs.pretender((server, helper) => {
-// server.post("/groups/47/test_email_settings", () => {
-// return helper.response(400, {
-// success: false,
-// errors: [
-// "There was an issue with the SMTP credentials provided, check the username and password and try again.",
-// ],
-// });
-// });
-// });
-
-// test("enabling IMAP, testing, and saving", async function (assert) {
-// await visit("/g/discourse/manage/email");
-
-// await click("#enable_smtp");
-// await click("#prefill_smtp_gmail");
-// await fillIn('input[name="username"]', "[email protected]");
-// await fillIn('input[name="password"]', "[email protected]");
-// await click(".test-smtp-settings");
-
-// assert.equal(
-// query(".modal-body").innerText,
-// "There was an issue with the SMTP credentials provided, check the username and password and try again.",
-// "shows a dialogue with the error message from the server"
-// );
-// await click(".modal-footer .btn.btn-primary");
-// });
-// }
-// );
+acceptance(
+ "Managing Group Email Settings - SMTP and IMAP Enabled - Email Test Invalid",
+ function (needs) {
+ needs.user();
+ needs.settings({ enable_smtp: true, enable_imap: true });
+
+ needs.pretender((server, helper) => {
+ server.post("/groups/47/test_email_settings", () => {
+ return helper.response(422, {
+ success: false,
+ errors: [
+ "There was an issue with the SMTP credentials provided, check the username and password and try again.",
+ ],
+ });
+ });
+ });
+
+ test("enabling IMAP, testing, and saving", async function (assert) {
+ await visit("/g/discourse/manage/email");
+
+ await click("#enable_smtp");
+ await click("#prefill_smtp_gmail");
+ await fillIn('input[name="username"]', "[email protected]");
+ await fillIn('input[name="password"]', "[email protected]");
+ await click(".test-smtp-settings");
+
+ assert.equal(
+ query(".modal-body").innerText,
+ "There was an issue with the SMTP credentials provided, check the username and password and try again.",
+ "shows a dialogue with the error message from the server"
+ );
+ await click(".modal-footer .btn.btn-primary");
+ });
+ }
+);