feat: Add link for instagram profile link (#6721)
This commit is contained in:
@@ -9,13 +9,22 @@ class Instagram::WebhooksBaseService
|
||||
def find_or_create_contact(user)
|
||||
@contact_inbox = @inbox.contact_inboxes.where(source_id: user['id']).first
|
||||
@contact = @contact_inbox.contact if @contact_inbox
|
||||
return if @contact
|
||||
|
||||
update_instagram_profile_link(user) && return if @contact
|
||||
|
||||
@contact_inbox = @inbox.channel.create_contact_inbox(
|
||||
user['id'], user['name']
|
||||
)
|
||||
|
||||
@contact = @contact_inbox.contact
|
||||
update_instagram_profile_link(user)
|
||||
Avatar::AvatarFromUrlJob.perform_later(@contact, user['profile_pic']) if user['profile_pic']
|
||||
end
|
||||
|
||||
def update_instagram_profile_link(user)
|
||||
return unless user['username']
|
||||
|
||||
@contact.additional_attributes = @contact.additional_attributes.merge({ 'social_profiles': { 'instagram': user['username'] } })
|
||||
@contact.save
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user