From 874446cd72f9edac60deb8dcd91cf2f019b5347c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 5 Nov 2018 16:36:21 -0800 Subject: Extract Mail-bound methods into mail_ext for future upstream work --- app/models/action_mailbox/inbound_email.rb | 6 +----- app/models/action_mailbox/inbound_email/message_id.rb | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'app/models') diff --git a/app/models/action_mailbox/inbound_email.rb b/app/models/action_mailbox/inbound_email.rb index 7d1a36b705..ea564a254e 100644 --- a/app/models/action_mailbox/inbound_email.rb +++ b/app/models/action_mailbox/inbound_email.rb @@ -8,12 +8,8 @@ class ActionMailbox::InboundEmail < ActiveRecord::Base has_one_attached :raw_email enum status: %i[ pending processing delivered failed bounced ] - def self.mail_from_source(source) - Mail.new Mail::Utilities.binary_unsafe_to_crlf(source.to_s) - end - def mail - @mail ||= self.class.mail_from_source(source) + @mail ||= Mail.from_source(source) end def source diff --git a/app/models/action_mailbox/inbound_email/message_id.rb b/app/models/action_mailbox/inbound_email/message_id.rb index 5cfcadaba1..70d39d1e33 100644 --- a/app/models/action_mailbox/inbound_email/message_id.rb +++ b/app/models/action_mailbox/inbound_email/message_id.rb @@ -14,7 +14,7 @@ module ActionMailbox::InboundEmail::MessageId private def extract_message_id(source) - mail_from_source(source).message_id + Mail.from_source(source).message_id rescue => e # FIXME: Add logging with "Couldn't extract Message ID, so will generating a new random ID instead" end -- cgit v1.2.3