From 5c0f6c856de37b022f5a429b50a1784cf374c45f Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 10 Mar 2017 11:13:57 +0000 Subject: Fix autocomplete in EE when permissions are sent 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. --- app/controllers/autocomplete_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/controllers/autocomplete_controller.rb') 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? -- cgit v1.2.1