Browse Source

Directly use User.visible_to_user instead of assigning to a variable first

pull/2646/head
Manny Dinssa 2 years ago
parent
commit
a88d2996a4
  1. 3
      app/controllers/users_controller.rb

3
app/controllers/users_controller.rb

@ -33,8 +33,7 @@ class UsersController < ApplicationController
end end
def search def search
user_options = User.visible_to_user(current_user) users = User.visible_to_user(current_user).search_by(params["query"]).limit(20)
users = user_options.search_by(params["query"]).limit(20)
user_data = users.each_with_object({}) do |user, hash| user_data = users.each_with_object({}) do |user, hash|
hash[user.id] = { value: user.name, hint: user.email } hash[user.id] = { value: user.name, hint: user.email }

Loading…
Cancel
Save