aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/incoming_message.rb14
-rw-r--r--app/models/request_mailer.rb8
2 files changed, 10 insertions, 12 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 11e31535b..002914bca 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -19,7 +19,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.196 2009-04-07 16:01:55 francis Exp $
+# $Id: incoming_message.rb,v 1.197 2009-04-08 05:29:35 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
@@ -1052,14 +1052,12 @@ class IncomingMessage < ActiveRecord::Base
return get_body_for_quoting + "\n\n" + get_attachment_text
end
- # Returns the name of the person the incoming message is from, or nil if there isn't one
- # or if there is only an email address.
+ # Returns the name of the person the incoming message is from, or nil if
+ # there isn't one or if there is only an email address. XXX can probably
+ # remove this and from_name_if_present (which is a monkey patch) by just
+ # calling .from_addrs[0].name instead? (as RequestMailer.name_for_followup etc. do)
def safe_mail_from
- if self.mail.from && (!self.mail.friendly_from.include?('@'))
- return self.mail.friendly_from
- else
- return nil
- end
+ self.mail.from_name_if_present
end
def mail_from_domain
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index a3a1e8b74..2e69be363 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_mailer.rb,v 1.70 2009-04-07 16:01:36 francis Exp $
+# $Id: request_mailer.rb,v 1.71 2009-04-08 05:29:35 francis Exp $
class RequestMailer < ApplicationMailer
@@ -37,7 +37,7 @@ class RequestMailer < ApplicationMailer
if incoming_message_followup.nil? || !incoming_message_followup.valid_to_reply_to?
return info_request.recipient_name_and_email
else
- return incoming_message_followup.mail.from_addrs[0].quoted_full
+ return incoming_message_followup.mail.from_addrs[0].full_quoted_address
end
end
# Used in the preview of followup
@@ -45,7 +45,7 @@ class RequestMailer < ApplicationMailer
if incoming_message_followup.nil? || !incoming_message_followup.valid_to_reply_to?
return info_request.public_body.name
else
- return incoming_message_followup.safe_mail_from || info_request.public_body.name
+ return incoming_message_followup.mail.from_addrs[0].name || info_request.public_body.name
end
end
# Used when making list of followup places to remove duplicates
@@ -92,7 +92,7 @@ class RequestMailer < ApplicationMailer
def stopped_responses(info_request, email)
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from # we don't care about bounces, likely from spammers
- @recipients = email.from_addrs[0].quoted_full
+ @recipients = email.from_addrs[0].full_quoted_address
@subject = "Your response to an FOI request was not delivered"
attachment :content_type => 'message/rfc822', :body => email.body
@body = {