Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
65df88c4
Commit
65df88c4
authored
Aug 15, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move ability check from service class to view
parent
22f44b50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
11 deletions
+6
-11
app/views/search/_category.html.haml
app/views/search/_category.html.haml
+6
-5
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+0
-2
spec/lib/gitlab/search_results_spec.rb
spec/lib/gitlab/search_results_spec.rb
+0
-4
No files found.
app/views/search/_category.html.haml
View file @
65df88c4
...
...
@@ -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
)
lib/gitlab/search_results.rb
View file @
65df88c4
...
...
@@ -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
...
...
spec/lib/gitlab/search_results_spec.rb
View file @
65df88c4
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment