Skip to content

Commit

Permalink
chore: add more logging to mailbox helpers [CW-3071] (#8909)
Browse files Browse the repository at this point in the history
* chore: add more logging to mailbox helpers

* fix: deleted entries

* fix: log order

* refactor: log using `processed_mail.message_id`
  • Loading branch information
scmmishra committed Feb 13, 2024
1 parent e662336 commit 33a6ad9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/mailboxes/mailbox_helper.rb
Expand Up @@ -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!(
Expand Down Expand Up @@ -36,6 +37,7 @@ def add_attachments_to_message
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,
Expand All @@ -46,6 +48,8 @@ def process_regular_attachments(attachments)
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]
Expand Down Expand Up @@ -98,7 +102,9 @@ def create_contact
}
}
).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?
Expand Down

0 comments on commit 33a6ad9

Please sign in to comment.