Merge branch 'develop' into feat/github-integration

This commit is contained in:
Muhsin Keloth
2025-08-07 18:29:25 +05:30
committed by GitHub
15 changed files with 311 additions and 80 deletions
@@ -61,6 +61,9 @@ class Twilio::IncomingMessageService
@contact_inbox = contact_inbox
@contact = contact_inbox.contact
# Update existing contact name if ProfileName is available and current name is just phone number
update_contact_name_if_needed
end
def conversation_params
@@ -173,4 +176,18 @@ class Twilio::IncomingMessageService
coordinates_long: params[:Longitude].to_f
)
end
def update_contact_name_if_needed
return if params[:ProfileName].blank?
return if @contact.name == params[:ProfileName]
# Only update if current name exactly matches the phone number or formatted phone number
return unless contact_name_matches_phone_number?
@contact.update!(name: params[:ProfileName])
end
def contact_name_matches_phone_number?
@contact.name == phone_number || @contact.name == formatted_phone_number
end
end