From 33a6ad9f7eb4fe82be807bfe0ffaa8a0d0b55741 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 13 Feb 2024 08:51:50 +0530 Subject: [PATCH] chore: add more logging to mailbox helpers [CW-3071] (#8909) * chore: add more logging to mailbox helpers * fix: deleted entries * fix: log order * refactor: log using `processed_mail.message_id` --- app/mailboxes/mailbox_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/mailboxes/mailbox_helper.rb b/app/mailboxes/mailbox_helper.rb index 5d1033d20..6b3afc133 100644 --- a/app/mailboxes/mailbox_helper.rb +++ b/app/mailboxes/mailbox_helper.rb @@ -2,6 +2,7 @@ module MailboxHelper private def create_message + Rails.logger.info "[MailboxHelper] Creating message #{processed_mail.message_id}" return if @conversation.messages.find_by(source_id: processed_mail.message_id).present? @message = @conversation.messages.create!( @@ -36,6 +37,7 @@ module MailboxHelper end def process_regular_attachments(attachments) + Rails.logger.info "[MailboxHelper] Processing regular attachments for message with ID: #{processed_mail.message_id}" attachments.each do |mail_attachment| attachment = @message.attachments.new( account_id: @conversation.account_id, @@ -46,6 +48,8 @@ module MailboxHelper end def process_inline_attachments(attachments) + Rails.logger.info "[MailboxHelper] Processing inline attachments for message with ID: #{processed_mail.message_id}" + # create an instance variable here, the `embed_inline_image_source` # updates them directly. And then the value is eventaully used to update the message content @html_content = processed_mail.serialized_data[:html_content][:full] @@ -98,7 +102,9 @@ module MailboxHelper } } ).perform + @contact = @contact_inbox.contact + Rails.logger.info "[MailboxHelper] Contact created with ID: #{@contact.id} for inbox with ID: #{@inbox.id}" end def notification_email_from_chatwoot?