chore: Fix nil class error at bot endpoint (#1177)

This commit is contained in:
Sojan Jose 2020-08-30 12:36:21 +05:30 committed by GitHub
parent 85ae6d92b9
commit 5ac093fca2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,14 +16,16 @@ class Integrations::Facebook::DeliveryStatus
end
def contact
::ContactInbox.find_by(source_id: sender_id).contact
::ContactInbox.find_by(source_id: sender_id)&.contact
end
def conversation
@conversation ||= ::Conversation.find_by(contact_id: contact.id)
@conversation ||= ::Conversation.find_by(contact_id: contact.id) if contact.present?
end
def update_message_status
return unless conversation
conversation.user_last_seen_at = @params.at
conversation.save!
end