Skip to content
Snippets Groups Projects
Commit afe04b07 authored by Alexis Reigel's avatar Alexis Reigel :coffee: Committed by Jan Provaznik
Browse files

move ability check from service class to view

parent 5ff7443f
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !8985. Comments created here will be created in the context of that merge request.
......@@ -100,8 +100,9 @@
Wiki
%span.badge.badge-pill
= limited_count(@search_results.wiki_blobs_count)
%li{ class: active_when(@scope == 'users') }
= link_to search_filter_path(scope: 'users') do
Users
%span.badge.badge-pill
= limited_count(@search_results.limited_users_count)
- if can?(current_user, :read_users_list)
%li{ class: active_when(@scope == 'users') }
= link_to search_filter_path(scope: 'users') do
Users
%span.badge.badge-pill
= limited_count(@search_results.limited_users_count)
......@@ -138,8 +138,6 @@ def merge_requests
# rubocop: enable CodeReuse/ActiveRecord
def users
return [] unless Ability.allowed?(current_user, :read_users_list)
UsersFinder.new(current_user, search: query).execute
end
......
......@@ -123,10 +123,6 @@
end
describe '#users' do
it 'returns an empty array when the current_user is not allowed to read users list' do
expect(results.objects('users')).to be_empty
end
it 'calls the UsersFinder' do
expect(UsersFinder).to receive(:new).with(user, search: 'foo').and_call_original
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment