Skip to content

Commit

Permalink
Add fallback to root group for every primary_group_id case when redir…
Browse files Browse the repository at this point in the history
…ecting
  • Loading branch information
njaeggi authored and amaierhofer committed Jan 2, 2025
1 parent 2c5ac89 commit 82dd867
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def redirect_to_login

def redirect_to_memberships_tab
flash[:notice] = t("groups.self_registration.create.existing_membership_notice")
redirect_to history_group_person_path(group_id: current_user.primary_group_id, id: current_user.id)
redirect_to history_group_person_path(group_id: current_user.primary_group_id || Group.root.id, id: current_user.id)
end

def redirect_to_person_show
flash[:notice] = t("groups.self_registration.create.existing_family_notice")
redirect_to history_group_person_path(group_id: current_user.primary_group_id, id: current_user.id)
redirect_to history_group_person_path(group_id: current_user.primary_group_id || Group.root.id, id: current_user.id)
end

def redirect_to_group_if_necessary
Expand All @@ -70,7 +70,7 @@ def redirect_to_group_if_necessary

def redirect_target
if current_user.present?
history_group_person_path(group_id: current_user.reload.primary_group_id, id: current_user.id)
history_group_person_path(group_id: current_user.reload.primary_group_id || Group.root.id, id: current_user.id)
else
new_person_session_path
end
Expand Down

0 comments on commit 82dd867

Please sign in to comment.