From 5ac093fca248736d301d2150de00177616ba8fae Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Sun, 30 Aug 2020 12:36:21 +0530 Subject: [PATCH] chore: Fix nil class error at bot endpoint (#1177) --- lib/integrations/facebook/delivery_status.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/integrations/facebook/delivery_status.rb b/lib/integrations/facebook/delivery_status.rb index 173d514ab..16ab5bdee 100644 --- a/lib/integrations/facebook/delivery_status.rb +++ b/lib/integrations/facebook/delivery_status.rb @@ -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