Merge pull request #8337 from aignatov-bio/ai-sci-11658-fix-shared-inventories-assigned-items

Fix shared inventories in assigning items modal [SCI-11658]
This commit is contained in:
aignatov-bio 2025-03-21 11:31:51 +01:00 committed by GitHub
commit 8270b101b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -51,7 +51,7 @@ class Repository < RepositoryBase
}
scope :appendable_by_user, lambda { |user, teams = user.current_team|
readable_ids = active.with_granted_permissions(user, RepositoryPermissions::ROWS_CREATE).where(team: teams).pluck(:id)
readable_ids = with_granted_permissions(user, RepositoryPermissions::ROWS_CREATE).where(team: teams).pluck(:id)
shared_with_team_ids = joins(:team_shared_objects, :team).where(team_shared_objects: { team: teams, permission_level: :shared_write }).pluck(:id)
globally_shared_ids =
if column_names.include?('permission_level')
@ -66,7 +66,7 @@ class Repository < RepositoryBase
none.pluck(:id)
end
where(id: (readable_ids + shared_with_team_ids + globally_shared_ids).uniq)
active.where(id: (readable_ids + shared_with_team_ids + globally_shared_ids).uniq)
}
def self.within_global_limits?