Commit 241f38b0 authored by Alexis Reigel's avatar Alexis Reigel

project's user search includes group members too

parent d7a3e54b
......@@ -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
......
......@@ -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
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