From 945288ce15f85bce45d9fc7b4d8fd43cdd320540 Mon Sep 17 00:00:00 2001 From: substr <36285899+substr2837@users.noreply.github.com> Date: Mon, 1 Aug 2022 21:29:27 +0700 Subject: [PATCH] fix: Trim search parameter value on contacts controller (#5114) Co-authored-by: richardokusumasali@gmail.com --- app/controllers/api/v1/accounts/contacts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/accounts/contacts_controller.rb b/app/controllers/api/v1/accounts/contacts_controller.rb index afb26e055..7ef3c0d87 100644 --- a/app/controllers/api/v1/accounts/contacts_controller.rb +++ b/app/controllers/api/v1/accounts/contacts_controller.rb @@ -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)