diff --git a/app/services/tiktok/messaging_helpers.rb b/app/services/tiktok/messaging_helpers.rb index b4295c736..0f167a3e0 100644 --- a/app/services/tiktok/messaging_helpers.rb +++ b/app/services/tiktok/messaging_helpers.rb @@ -26,7 +26,7 @@ module Tiktok::MessagingHelpers end def find_conversation(channel, tt_conversation_id) - channel.inbox.contact_inboxes.find_by(source_id: tt_conversation_id).conversations.first + channel.inbox.contact_inboxes.find_by(source_id: tt_conversation_id)&.conversations&.first end def create_conversation(channel, contact_inbox, tt_conversation_id) diff --git a/app/services/tiktok/read_status_service.rb b/app/services/tiktok/read_status_service.rb index e09c6e8cf..02b255e94 100644 --- a/app/services/tiktok/read_status_service.rb +++ b/app/services/tiktok/read_status_service.rb @@ -4,9 +4,9 @@ class Tiktok::ReadStatusService pattr_initialize [:channel!, :content!] def perform - return if channel.blank? || content.blank? || outbound_event? + return if channel.blank? || content.blank? || outbound_event? || conversation.blank? - ::Conversations::UpdateMessageStatusJob.perform_later(conversation.id, last_read_timestamp) if conversation.present? + ::Conversations::UpdateMessageStatusJob.perform_later(conversation.id, last_read_timestamp) end def conversation