fix: order for canned response (#6400)
* feat: order canned response Order canned responses by short_code match first and then with content * Added specs --------- Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -33,7 +33,10 @@ class Api::V1::Accounts::CannedResponsesController < Api::V1::Accounts::BaseCont
|
||||
|
||||
def canned_responses
|
||||
if params[:search]
|
||||
Current.account.canned_responses.where('short_code ILIKE :search OR content ILIKE :search', search: "%#{params[:search]}%")
|
||||
Current.account.canned_responses
|
||||
.where('short_code ILIKE :search OR content ILIKE :search', search: "%#{params[:search]}%")
|
||||
.order_by_search(params[:search])
|
||||
|
||||
else
|
||||
Current.account.canned_responses
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user