Skip to content

Commit

Permalink
Only update current team if User belongs to it
Browse files Browse the repository at this point in the history
  • Loading branch information
gazayas authored and jagthedrummer committed Aug 31, 2023
1 parent 0b2730f commit bfabae1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def ensure_onboarding_is_complete_and_set_next_step
def ensure_onboarding_is_complete
# This is temporary, but if we've gotten this far and `@team` is loaded, we need to ensure current_team is
# updated for the checks below. This entire concept of `current_team` is going away soon.
current_user.update(current_team: @team) if @team&.persisted?
current_user.update(current_team: @team) if @team&.persisted? && current_user.teams.include?(@team)

# since the onboarding controllers are child classes of this class,
# we actually have to check to make sure we're not currently on that
Expand Down
2 changes: 1 addition & 1 deletion bullet_train/app/helpers/account/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ def ui_avatar_params(email, first_name, last_name)
end

def current_membership
current_user.memberships.where(team: current_team).first
current_user.memberships.where(team: current_user.current_team).first
end
end

0 comments on commit bfabae1

Please sign in to comment.