use project_search_tabs? for user search check

This commit is contained in:
Alexis Reigel 2018-12-18 09:35:54 +01:00
parent db0cf70970
commit b4437cfaec
No known key found for this signature in database
GPG key ID: 55ADA7C7B683B329
3 changed files with 11 additions and 2 deletions

View file

@ -364,7 +364,8 @@ module ProjectsHelper
blobs: :download_code,
commits: :download_code,
merge_requests: :read_merge_request,
notes: [:read_merge_request, :download_code, :read_issue, :read_project_snippet]
notes: [:read_merge_request, :download_code, :read_issue, :read_project_snippet],
members: :read_project_member
)
end

View file

@ -201,4 +201,12 @@ module SearchHelper
def limited_count(count, limit = 1000)
count > limit ? "#{limit}+" : count
end
def search_tabs?(tab)
if @project
project_search_tabs?(:members)
else
can?(current_user, :read_users_list)
end
end
end

View file

@ -1,5 +1,5 @@
- users = capture_haml do
- if can?(current_user, :read_users_list)
- if search_tabs?(:members)
%li{ class: active_when(@scope == 'users') }
= link_to search_filter_path(scope: 'users') do
Users