GRN2-310: Share Access now dynamically pulls the list of users from the server (#2380)

* Share Access now dynamically pulls the list of users from the server

* Merge users now dynamically pulls the list of users from the server

* Only return the information needed to the front-end
This commit is contained in:
Ahmad Farhat
2020-12-21 17:21:17 -05:00
committed by GitHub
parent 155d214215
commit 86e6056d3c
11 changed files with 111 additions and 40 deletions

View File

@ -95,6 +95,24 @@ class User < ApplicationRecord
order(Arel.sql("users.#{column} #{direction}"))
end
def self.shared_list_search(string)
return all if string.blank?
search_query = "users.name LIKE :search OR users.uid LIKE :search"
search_param = "%#{sanitize_sql_like(string)}%"
where(search_query, search: search_param)
end
def self.merge_list_search(string)
return all if string.blank?
search_query = "users.name LIKE :search OR users.email LIKE :search"
search_param = "%#{sanitize_sql_like(string)}%"
where(search_query, search: search_param)
end
# Returns a list of rooms ordered by last session (with nil rooms last)
def ordered_rooms
return [] if main_room.nil?