Merge pull request #7548 from rekonder/aj_SCI_10690

Fix links for repository row global search results [SCI-10690]
This commit is contained in:
ajugo 2024-05-13 11:26:36 +02:00 committed by GitHub
commit e005dee791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -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)
}

View file

@ -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