From 676f0897ac55b465d2a89fda5ded1875bc798fce Mon Sep 17 00:00:00 2001 From: Renato Atilio Date: Wed, 21 Aug 2024 13:50:38 -0300 Subject: [PATCH] FIX: subfolder account activation (#28463) --- .../app/templates/activate-account.gjs | 17 ++++++------ spec/system/signup_spec.rb | 27 +++++++++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/app/templates/activate-account.gjs b/app/assets/javascripts/discourse/app/templates/activate-account.gjs index 92e1b0e5381..eac12373c45 100644 --- a/app/assets/javascripts/discourse/app/templates/activate-account.gjs +++ b/app/assets/javascripts/discourse/app/templates/activate-account.gjs @@ -10,6 +10,7 @@ import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { wavingHandURL } from "discourse/lib/waving-hand-url"; import i18n from "discourse-common/helpers/i18n"; +import getURL from "discourse-common/lib/get-url"; export default RouteTemplate( class extends Component { @@ -26,12 +27,7 @@ export default RouteTemplate( let hp; try { - const response = await fetch("/session/hp", { - headers: { - Accept: "application/json", - }, - }); - hp = await response.json(); + hp = await ajax("/session/hp"); } catch (error) { this.isLoading = false; popupAjaxError(error); @@ -62,13 +58,18 @@ export default RouteTemplate( } else if (response.needs_approval) { this.needsApproval = true; } else { - setTimeout(() => (window.location.href = "/"), 2000); + setTimeout(this.loadHomepage, 2000); } } catch (error) { this.errorMessage = i18n("user.activate_account.already_done"); } } + @action + loadHomepage() { + window.location.href = getURL("/"); + } +