mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 03:36:44 +08:00
Fix global search for inventory items from shared inventories [SCI-11532] (#8212)
This commit is contained in:
parent
3694bd6f2b
commit
bfb067cd7a
2 changed files with 2 additions and 6 deletions
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue