mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-11 00:41:41 +08:00
Fix user removal from projects when leaving a team [SCI-6323]
This commit is contained in:
parent
30031e2f07
commit
8ef0ba2200
1 changed files with 3 additions and 1 deletions
|
|
@ -44,6 +44,8 @@ module UserAssignments
|
||||||
|
|
||||||
sync_resource_user_associations(child_association)
|
sync_resource_user_associations(child_association)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
destroy_or_update_user_assignment(resource) if resource.is_a?(Project) && @destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_or_update_user_assignment(object)
|
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 }
|
user_assignment = object.user_assignments.find { |ua| ua.user_id == @user.id }
|
||||||
return if user_assignment.blank?
|
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
|
# if project is public, the assignment
|
||||||
# will reset to the default public role
|
# will reset to the default public role
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue