diff options
Diffstat (limited to 'app/models/incoming_message.rb')
-rw-r--r-- | app/models/incoming_message.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 427059b15..a6a869769 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 24 +# Schema version: 25 # # Table name: incoming_messages # @@ -20,7 +20,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.25 2008-01-07 15:08:59 francis Exp $ +# $Id: incoming_message.rb,v 1.26 2008-01-10 01:13:28 francis Exp $ class IncomingMessage < ActiveRecord::Base belongs_to :info_request @@ -30,6 +30,8 @@ class IncomingMessage < ActiveRecord::Base has_many :rejection_reasons + has_many :outgoing_message_followups, :class_name => OutgoingMessage + # Return the structured TMail::Mail object # Documentation at http://i.loveruby.net/en/projects/tmail/doc/ def mail @@ -155,6 +157,15 @@ class IncomingMessage < ActiveRecord::Base return 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. + def safe_mail_from + if self.mail.from and (not self.mail.friendly_from.include?('@')) + return self.mail.friendly_from + else + return nil + end + end end |