Fix global search for inventory items from shared inventories [SCI-11532] (#8212)

This commit is contained in:
Alex Kriuchykhin 2025-02-06 09:26:25 +01:00 committed by GitHub
parent 3694bd6f2b
commit bfb067cd7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -114,7 +114,7 @@ class SearchController < ApplicationController
return
when 'repository_rows'
@model = RepositoryRow
search_by_name(RepositoryRow)
search_by_name
render json: @records,
each_serializer: GlobalSearch::RepositoryRowSerializer,

View file

@ -137,11 +137,7 @@ class RepositoryRow < ApplicationRecord
teams = options[:teams] || current_team || user.teams.select(:id)
searchable_row_fields = [RepositoryRow::PREFIXED_ID_SQL, 'repository_rows.name', 'users.full_name']
readable_rows =
distinct
.joins(:repository, :created_by)
.where(repositories: { id: Repository.with_granted_permissions(user, RepositoryPermissions::READ).select(:id),
team_id: teams })
readable_rows = distinct.joins(:repository, :created_by).viewable_by_user(user, teams)
readable_rows = readable_rows.active unless include_archived
repository_rows = readable_rows.where_attributes_like_boolean(searchable_row_fields, query, options)