Commit d7ac635b authored by Sean McGivern's avatar Sean McGivern

Merge branch '29316-can-t-select-a-mirror-user-ee' into 'master'

Fix 500 when selecting a mirror user

Closes gitlab-ce#29316

See merge request !1404
parents cabd2e8d 76d0718c
...@@ -18,8 +18,7 @@ class AutocompleteController < ApplicationController ...@@ -18,8 +18,7 @@ class AutocompleteController < ApplicationController
if params[:search].blank? if params[:search].blank?
# Include current user if available to filter by "Me" # Include current user if available to filter by "Me"
if params[:current_user].present? && current_user if params[:current_user].present? && current_user
@users = @users.where.not(id: current_user.id) @users = [current_user, *@users].uniq
@users = [current_user, *@users]
end end
if params[:author_id].present? if params[:author_id].present?
......
---
title: Fix 500 error when selecting a mirror user
merge_request:
author:
...@@ -61,6 +61,18 @@ describe AutocompleteController do ...@@ -61,6 +61,18 @@ describe AutocompleteController do
it { expect(body.size).to eq 2 } it { expect(body.size).to eq 2 }
it { expect(body.map { |user| user["username"] }).to match_array([user.username, user2.username]) } it { expect(body.map { |user| user["username"] }).to match_array([user.username, user2.username]) }
end end
describe "GET #users that can push to protected branches, including the current user" do
before do
get(:users, project_id: project.id, push_code_to_protected_branches: true, current_user: true)
end
let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 1 }
it { expect(body.first["username"]).to eq user.username }
end
end end
context 'group members' do context 'group members' do
......
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