fix: Trim search parameter value on contacts controller (#5114)

Co-authored-by: richardokusumasali@gmail.com <chi>
This commit is contained in:
substr 2022-08-01 21:29:27 +07:00 committed by GitHub
parent 8db5a528ef
commit 945288ce15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,7 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController
contacts = resolved_contacts.where(
'name ILIKE :search OR email ILIKE :search OR phone_number ILIKE :search OR contacts.identifier LIKE :search',
search: "%#{params[:q]}%"
search: "%#{params[:q].strip}%"
)
@contacts_count = contacts.count
@contacts = fetch_contacts_with_conversation_count(contacts)