Commit 65df88c4 authored by Alexis Reigel's avatar Alexis Reigel

move ability check from service class to view

parent 22f44b50
......@@ -84,8 +84,9 @@
= _("Milestones")
%span.badge.badge-pill
= limited_count(@search_results.limited_milestones_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 @@ module Gitlab
# 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 @@ describe Gitlab::SearchResults do
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment