Compare commits

...
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -102,7 +102,7 @@ class Imap::ImapMailbox
auto_reply: @processed_mail.auto_reply?, auto_reply: @processed_mail.auto_reply?,
mail_subject: @processed_mail.subject, mail_subject: @processed_mail.subject,
initiated_at: { initiated_at: {
timestamp: Time.now.utc timestamp: @processed_mail.date&.utc || Time.now.utc
} }
} }
} }
+3
View File
@@ -1,6 +1,7 @@
module MailboxHelper module MailboxHelper
private private
# rubocop:disable Metrics/AbcSize
def create_message def create_message
Rails.logger.info "[MailboxHelper] Creating message #{processed_mail.message_id}" Rails.logger.info "[MailboxHelper] Creating message #{processed_mail.message_id}"
return if @conversation.messages.find_by(source_id: processed_mail.message_id).present? return if @conversation.messages.find_by(source_id: processed_mail.message_id).present?
@@ -13,6 +14,7 @@ module MailboxHelper
message_type: 'incoming', message_type: 'incoming',
content_type: 'incoming_email', content_type: 'incoming_email',
source_id: processed_mail.message_id, source_id: processed_mail.message_id,
created_at: processed_mail.date&.utc || Time.current,
content_attributes: { content_attributes: {
email: processed_mail.serialized_data, email: processed_mail.serialized_data,
cc_email: processed_mail.cc, cc_email: processed_mail.cc,
@@ -20,6 +22,7 @@ module MailboxHelper
} }
) )
end end
# rubocop:enable Metrics/AbcSize
def add_attachments_to_message def add_attachments_to_message
return if @message.blank? return if @message.blank?