Merge pull request #3724 from okriuchykhin/ok_SCI_6323_v2

Fix user removal from projects when leaving a team [SCI-6323]
This commit is contained in:
Alex Kriuchykhin 2021-12-07 10:27:14 +01:00 committed by GitHub
commit f309205bc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,6 +44,8 @@ module UserAssignments
sync_resource_user_associations(child_association)
end
destroy_or_update_user_assignment(resource) if resource.is_a?(Project) && @destroy
end
def create_or_update_user_assignment(object)
@ -63,7 +65,7 @@ module UserAssignments
user_assignment = object.user_assignments.find { |ua| ua.user_id == @user.id }
return if user_assignment.blank?
if object.project.visible? && !@remove_from_team
if !object.is_a?(Project) && object.project.visible? && !@remove_from_team
# if project is public, the assignment
# will reset to the default public role