mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 20:23:16 +08:00
Merge pull request #7548 from rekonder/aj_SCI_10690
Fix links for repository row global search results [SCI-10690]
This commit is contained in:
commit
e005dee791
2 changed files with 4 additions and 3 deletions
|
@ -7,7 +7,7 @@ module PermissionCheckableModel
|
|||
include PermissionExtends
|
||||
|
||||
scope :with_granted_permissions, lambda { |user, permissions|
|
||||
left_outer_joins(user_assignments: :user_role)
|
||||
joins(user_assignments: :user_role)
|
||||
.where(user_assignments: { user: user })
|
||||
.where('user_roles.permissions @> ARRAY[?]::varchar[]', permissions)
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@ module GlobalSearch
|
|||
attributes :id, :name, :code, :created_at, :created_by, :team, :repository, :archived, :url
|
||||
|
||||
def team
|
||||
team = object.repository.shared_with?(current_user.current_team) ? current_user.current_team : object.team
|
||||
{
|
||||
name: object.team.name,
|
||||
url: dashboard_path(team: object.team)
|
||||
name: team.name,
|
||||
url: dashboard_path(team: team)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue