Skip to content

Commit

Permalink
updated shared access search to include email as well as name (#5681)
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentFlameCR authored Jan 26, 2024
1 parent b65912b commit a60752d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/shared_accesses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def shareable_users
.with_provider(current_provider)
.where.not(id: [@room.shared_users.pluck(:id) << @room.user_id])
.where(role_id: [role_ids])
.name_search(params[:search])
.shared_access_search(params[:search])
render_data data: shareable_users, serializer: SharedAccessSerializer, status: :ok
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def self.search(input)
all
end

def self.name_search(input)
return where('users.name ILIKE :input', input: "%#{input}%") if input
def self.shared_access_search(input)
return where('users.name ILIKE :input OR users.email ILIKE :input', input: "%#{input}%") if input

all
end
Expand Down

0 comments on commit a60752d

Please sign in to comment.