From ab92058bbdb3240dca2fbf51d86a720ee7bce1ca Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 27 Sep 2018 17:37:34 -0700 Subject: Sharpen terminology raw_email_content => source --- app/models/action_mailroom/inbound_email.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/action_mailroom/inbound_email.rb b/app/models/action_mailroom/inbound_email.rb index f9842eead7..6dd643073a 100644 --- a/app/models/action_mailroom/inbound_email.rb +++ b/app/models/action_mailroom/inbound_email.rb @@ -13,19 +13,23 @@ class ActionMailroom::InboundEmail < ActiveRecord::Base create! raw_email: raw_email, message_id: extract_message_id(raw_email), **options end - def mail_from_raw_content(raw_email_content) - Mail.new(Mail::Utilities.binary_unsafe_to_crlf(raw_email_content.to_s)) + def mail_from_source(source) + Mail.new(Mail::Utilities.binary_unsafe_to_crlf(source.to_s)) end private def extract_message_id(raw_email) - mail_from_raw_content(raw_email.read).message_id + mail_from_source(raw_email.read).message_id rescue => e # TODO: Assign message id if it can't be extracted? end end def mail - @mail ||= self.class.mail_from_raw_content(raw_email.download) + @mail ||= self.class.mail_from_source(source) + end + + def source + @source ||= raw_email.download end end -- cgit v1.2.3