Skip to content

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

FIX: show loading spinner when redirecting to discourse connect (#34135)

Régis Hanol61b0a3730b68
diff --git a/app/assets/javascripts/discourse/app/routes/login.js b/app/assets/javascripts/discourse/app/routes/login.js
index de7292473fa..3042dbdcab6 100644
--- a/app/assets/javascripts/discourse/app/routes/login.js
+++ b/app/assets/javascripts/discourse/app/routes/login.js
@@ -17,7 +17,7 @@ export default class extends DiscourseRoute {
@service site;
@service siteSettings;
- isRedirecting = false;
+ #isRedirecting = false;
beforeModel(transition) {
const { from, wantsTo } = transition;
@@ -69,7 +69,7 @@ export default class extends DiscourseRoute {
// Automatically kick off the external login if it's the only one available
if (isOnlyOneExternalLoginMethod) {
if (auth_immediately || login_required || !from || wantsTo) {
- this.isRedirecting = true;
+ this.#isRedirecting = true;
singleExternalLogin();
} else {
router.replaceWith("discovery.login-required");
@@ -78,6 +78,8 @@ export default class extends DiscourseRoute {
}
setupController(controller) {
+ const { enable_discourse_connect } = this.siteSettings;
+
super.setupController(...arguments);
// We're in the middle of an authentication flow
@@ -85,6 +87,8 @@ export default class extends DiscourseRoute {
return;
}
- controller.isRedirectingToExternalAuth = this.isRedirecting;
+ // Shows the loading spinner while waiting for the redirection to external auth
+ controller.isRedirectingToExternalAuth =
+ this.#isRedirecting || enable_discourse_connect;
}
}
diff --git a/app/assets/javascripts/discourse/app/routes/signup.js b/app/assets/javascripts/discourse/app/routes/signup.js
index 1b05884070a..fc75a24e6bd 100644
--- a/app/assets/javascripts/discourse/app/routes/signup.js
+++ b/app/assets/javascripts/discourse/app/routes/signup.js
@@ -18,7 +18,7 @@ export default class extends DiscourseRoute {
@service site;
@service siteSettings;
- isRedirecting = false;
+ #isRedirecting = false;
beforeModel(transition) {
const { from, wantsTo } = transition;
@@ -82,7 +82,7 @@ export default class extends DiscourseRoute {
// Automatically kick off the external login if it's the only one available
if (isOnlyOneExternalLoginMethod) {
if (auth_immediately || login_required || !from || wantsTo) {
- this.isRedirecting = true;
+ this.#isRedirecting = true;
singleExternalLogin({ signup: true });
} else {
router.replaceWith("discovery.login-required");
@@ -91,6 +91,8 @@ export default class extends DiscourseRoute {
}
setupController(controller) {
+ const { enable_discourse_connect } = this.siteSettings;
+
super.setupController(...arguments);
// We're in the middle of an authentication flow
@@ -98,6 +100,8 @@ export default class extends DiscourseRoute {
return;
}
- controller.isRedirectingToExternalAuth = this.isRedirecting;
+ // Shows the loading spinner while waiting for the redirection to external auth
+ controller.isRedirectingToExternalAuth =
+ this.#isRedirecting || enable_discourse_connect;
}
}