summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-03-10 11:13:57 +0000
committerSean McGivern <sean@gitlab.com>2017-03-10 11:41:44 +0000
commit5c0f6c856de37b022f5a429b50a1784cf374c45f (patch)
tree8138f05a37503980dd5fb01b3fe0dc926647f590
parent7ac732a2b4383800d40cfd1af906a07de3df0e7a (diff)
downloadgitlab-ce-29316-can-t-select-a-mirror-user.tar.gz
Fix autocomplete in EE when permissions are sent29316-can-t-select-a-mirror-user
In EE, `@users` can be an array at the point where we remove the current user, because it can do a permissions check on the users for project mirroring. Fix this in CE by only using array methods, not AR methods. We can't use `delete` because that uses `Object#equal?`, which isn't true in this case.
-rw-r--r--app/controllers/autocomplete_controller.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb
index d7a45bacd35..b79ca034c5b 100644
--- a/app/controllers/autocomplete_controller.rb
+++ b/app/controllers/autocomplete_controller.rb
@@ -18,8 +18,7 @@ class AutocompleteController < ApplicationController
if params[:search].blank?
# Include current user if available to filter by "Me"
if params[:current_user].present? && current_user
- @users = @users.where.not(id: current_user.id)
- @users = [current_user, *@users]
+ @users = [current_user, *@users].uniq
end
if params[:author_id].present?