diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 41a4ffe..1946c13 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -4,4 +4,4 @@ en: debtcollective_algolia_app_id: 'Algolia Places App ID' debtcollective_algolia_api_key: 'Algolia Places API key' debtcollective_algolia_api_key: 'Algolia Places API key' - debtcollective_redirect_url_after_signup: 'Redirect URL after user accepts an invite. ex https://debtcollective.org/hub' + debtcollective_after_signup_redirect_url: 'Redirect URL after user accepts an invite. ex https://debtcollective.org/hub' diff --git a/config/settings.yml b/config/settings.yml index 3bd9866..f445420 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -22,6 +22,6 @@ plugins: debtcollective_solidarity_message_title: default: "Solidarity Bloc" client: false - debtcollective_redirect_url_after_signup: + debtcollective_after_signup_redirect_url: default: "https://debtcollective.org/hub" client: true diff --git a/lib/extensions/invites_controller.rb b/lib/extensions/invites_controller.rb index 8f6d43f..9368a1b 100644 --- a/lib/extensions/invites_controller.rb +++ b/lib/extensions/invites_controller.rb @@ -31,7 +31,7 @@ def perform_accept_invitation # If this is a new user or first login, redirect # we only set it if topic invite is nil - redirect_to = SiteSetting.debtcollective_redirect_url_after_signup + redirect_to = SiteSetting.debtcollective_after_signup_redirect_url if (user.new_user? || !user.seen_before?) && redirect_to.present? && topic.blank? response[:redirect_to] = redirect_to end diff --git a/lib/extensions/session_controller.rb b/lib/extensions/session_controller.rb index f8adfdd..71d53a4 100644 --- a/lib/extensions/session_controller.rb +++ b/lib/extensions/session_controller.rb @@ -82,7 +82,7 @@ def email_login response = { success: 'OK' } - redirect_to = SiteSetting.debtcollective_redirect_url_after_signup + redirect_to = SiteSetting.debtcollective_after_signup_redirect_url response[:redirect_to] = redirect_to if redirect_to.present? && !user.seen_before? return render json: response diff --git a/spec/requests/session_controller_spec.rb b/spec/requests/session_controller_spec.rb index 7ba2ce9..7932f61 100644 --- a/spec/requests/session_controller_spec.rb +++ b/spec/requests/session_controller_spec.rb @@ -41,7 +41,7 @@ it "redirects to after_signup_path if it's the first login" do user = Fabricate(:user) email_token = user.email_tokens.create!(email: user.email) - SiteSetting.debtcollective_redirect_url_after_signup = "https://example.com" + SiteSetting.debtcollective_after_signup_redirect_url = "https://example.com" post "/session/email-login/#{email_token.token}", headers: { "ACCEPT" => "application/json" } json = JSON.parse(response.body)