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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
241f38b0
Commit
241f38b0
authored
Dec 11, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project's user search includes group members too
parent
d7a3e54b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+1
-1
spec/lib/gitlab/project_search_results_spec.rb
spec/lib/gitlab/project_search_results_spec.rb
+19
-3
No files found.
lib/gitlab/project_search_results.rb
View file @
241f38b0
...
...
@@ -30,7 +30,7 @@ module Gitlab
end
def
users
super
.
where
(
id:
@project
.
users
)
super
.
where
(
id:
@project
.
team
.
members
)
# rubocop:disable CodeReuse/ActiveRecord
end
def
blobs_count
...
...
spec/lib/gitlab/project_search_results_spec.rb
View file @
241f38b0
...
...
@@ -414,9 +414,9 @@ describe Gitlab::ProjectSearchResults do
end
describe
'user search'
do
let
(
:project
)
{
create
(
:project
)
}
it
'returns the user belonging to the project matching the search query'
do
project
=
create
(
:project
)
it
'returns the users belonging to the project matching the search query'
do
user1
=
create
(
:user
,
username:
'gob_bluth'
)
create
(
:project_member
,
:developer
,
user:
user1
,
project:
project
)
...
...
@@ -425,7 +425,23 @@ describe Gitlab::ProjectSearchResults do
create
(
:user
,
username:
'gob_2018'
)
expect
(
described_class
.
new
(
user
,
project
,
'gob'
).
objects
(
'users'
)).
to
eq
[
user1
]
result
=
described_class
.
new
(
user
,
project
,
'gob'
).
objects
(
'users'
)
expect
(
result
).
to
eq
[
user1
]
end
it
'returns the user belonging to the group matching the search query'
do
group
=
create
(
:group
)
project
=
create
(
:project
,
namespace:
group
)
user1
=
create
(
:user
,
username:
'gob_bluth'
)
create
(
:group_member
,
:developer
,
user:
user1
,
group:
group
)
create
(
:user
,
username:
'gob_2018'
)
result
=
described_class
.
new
(
user
,
project
,
'gob'
).
objects
(
'users'
)
expect
(
result
).
to
eq
[
user1
]
end
end
end
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