chore: Refactor Contact Inbox Builders (#5617)
- Remove duplicate code and move everything to builders - fixes: #4680
This commit is contained in:
@@ -81,7 +81,7 @@ class Line::IncomingMessageService
|
||||
end
|
||||
|
||||
def set_contact
|
||||
contact_inbox = ::ContactBuilder.new(
|
||||
contact_inbox = ::ContactInboxWithContactBuilder.new(
|
||||
source_id: line_contact_info['userId'],
|
||||
inbox: inbox,
|
||||
contact_attributes: contact_attributes
|
||||
|
||||
@@ -37,7 +37,7 @@ class Sms::IncomingMessageService
|
||||
end
|
||||
|
||||
def set_contact
|
||||
contact_inbox = ::ContactBuilder.new(
|
||||
contact_inbox = ::ContactInboxWithContactBuilder.new(
|
||||
source_id: params[:from],
|
||||
inbox: @inbox,
|
||||
contact_attributes: contact_attributes
|
||||
|
||||
@@ -31,7 +31,7 @@ class Telegram::IncomingMessageService
|
||||
end
|
||||
|
||||
def set_contact
|
||||
contact_inbox = ::ContactBuilder.new(
|
||||
contact_inbox = ::ContactInboxWithContactBuilder.new(
|
||||
source_id: params[:message][:from][:id],
|
||||
inbox: inbox,
|
||||
contact_attributes: contact_attributes
|
||||
|
||||
@@ -47,7 +47,7 @@ class Twilio::IncomingMessageService
|
||||
end
|
||||
|
||||
def set_contact
|
||||
contact_inbox = ::ContactBuilder.new(
|
||||
contact_inbox = ::ContactInboxWithContactBuilder.new(
|
||||
source_id: params[:From],
|
||||
inbox: inbox,
|
||||
contact_attributes: contact_attributes
|
||||
|
||||
@@ -48,7 +48,7 @@ class Whatsapp::IncomingMessageBaseService
|
||||
contact_params = @processed_params[:contacts]&.first
|
||||
return if contact_params.blank?
|
||||
|
||||
contact_inbox = ::ContactBuilder.new(
|
||||
contact_inbox = ::ContactInboxWithContactBuilder.new(
|
||||
source_id: contact_params[:wa_id],
|
||||
inbox: inbox,
|
||||
contact_attributes: { name: contact_params.dig(:profile, :name), phone_number: "+#{@processed_params[:messages].first[:from]}" }
|
||||
|
||||
Reference in New Issue
Block a user