Skip to content
Snippets Groups Projects

Fix issue with endless redirect

All threads resolved!
Files
3
@@ -4,6 +4,7 @@ module Registrations
@@ -4,6 +4,7 @@ module Registrations
class WelcomeController < ApplicationController
class WelcomeController < ApplicationController
include OneTrustCSP
include OneTrustCSP
include GoogleAnalyticsCSP
include GoogleAnalyticsCSP
 
include ::Gitlab::Utils::StrongMemoize
layout 'minimal'
layout 'minimal'
skip_before_action :authenticate_user!, :required_signup_info, :check_two_factor_requirement, only: [:show, :update]
skip_before_action :authenticate_user!, :required_signup_info, :check_two_factor_requirement, only: [:show, :update]
@@ -24,6 +25,7 @@ def update
@@ -24,6 +25,7 @@ def update
if result.success?
if result.success?
track_event('successfully_submitted_form')
track_event('successfully_submitted_form')
 
finish_onboarding_on_welcome_page unless complete_to_signup_onboarding?
redirect_to update_success_path
redirect_to update_success_path
else
else
@@ -34,6 +36,8 @@ def update
@@ -34,6 +36,8 @@ def update
private
private
def registering_from_invite?(members)
def registering_from_invite?(members)
 
# If there are more than one member it will mean we have been invited to multiple projects/groups and
 
# are not able to distinguish which one we should putting the user in after registration
members.count == 1 && members.last.source.present?
members.count == 1 && members.last.source.present?
end
end
@@ -61,33 +65,33 @@ def members_activity_path(members)
@@ -61,33 +65,33 @@ def members_activity_path(members)
end
end
# overridden in EE
# overridden in EE
def redirect_to_signup_onboarding?
def complete_to_signup_onboarding?
false
false
end
end
def redirect_for_tasks_to_be_done?
def invites_with_tasks_to_be_done?
MemberTask.for_members(current_user.members).exists?
MemberTask.for_members(user_members).exists?
end
end
def update_success_path
def update_success_path
if redirect_for_tasks_to_be_done?
if invites_with_tasks_to_be_done?
finish_onboarding_on_welcome_page
issues_dashboard_path(assignee_username: current_user.username)
return issues_dashboard_path(assignee_username: current_user.username)
elsif complete_to_signup_onboarding? # trials/regular registration on .com
end
signup_onboarding_path
elsif registering_from_invite?(user_members) # invites w/o tasks due to order
return signup_onboarding_path if redirect_to_signup_onboarding?
flash[:notice] = helpers.invite_accepted_notice(user_members.last)
members_activity_path(user_members)
finish_onboarding_on_welcome_page
else
members = current_user.members
# Subscription registrations goes through here as well.
# Invites will come here too if there is more than 1.
if registering_from_invite?(members)
path_for_signed_in_user(current_user)
flash[:notice] = helpers.invite_accepted_notice(members.last)
return members_activity_path(members)
end
end
 
end
# subscription registrations goes through here as well
def user_members
path_for_signed_in_user(current_user)
current_user.members
end
end
 
strong_memoize_attr :user_members
# overridden in EE
# overridden in EE
def finish_onboarding_on_welcome_page; end
def finish_onboarding_on_welcome_page; end
Loading