diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-04 10:19:39 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-04 10:19:39 +0000 |
commit | 700ba5932ff1ed92500d5c5b122b08172fea7d30 (patch) | |
tree | 3c91fc5ce34942b506e08282ec160611e95ec439 | |
parent | 6ff66def8325d3693377ff35a53981751cafda55 (diff) |
Remove duplicate method that was masking what seems to be intended to be the real valid_to_reply_to? method - which accesses cached values. Replacing the _calculate_valid_to_reply_to logic with the code that will have actually been running.
-rw-r--r-- | app/models/incoming_message.rb | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 9de2550ab..0ebf0017d 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -103,7 +103,7 @@ class IncomingMessage < ActiveRecord::Base prefix = email prefix =~ /^(.*)@/ prefix = $1 - if !prefix.nil? && prefix.downcase.match(/^(postmaster|mailer-daemon|auto_reply|donotreply|no.reply)$/) + if !prefix.nil? && prefix.downcase.match(/^(postmaster|mailer-daemon|auto_reply|do.?not.?reply|no.reply)$/) return false end if !self.mail['return-path'].nil? && self.mail['return-path'].addr == "<>" @@ -1043,35 +1043,6 @@ class IncomingMessage < ActiveRecord::Base return AlaveteliFileTypes.all_extensions.join(" ") end - # Return false if for some reason this is a message that we shouldn't let them reply to - def valid_to_reply_to? - # check validity of email - if empty_from_field? - return false - end - email = self.from_email - if !MySociety::Validate.is_valid_email(email) - return false - end - - # reject postmaster - authorities seem to nearly always not respond to - # email to postmaster, and it tends to only happen after delivery failure. - # likewise Mailer-Daemon, Auto_Reply... - prefix = email - prefix =~ /^(.*)@/ - prefix = $1 - if !prefix.nil? && prefix.downcase.match(/^(postmaster|mailer-daemon|auto_reply|do.?not.?reply|no.reply)$/) - return false - end - if !self.mail['return-path'].nil? && self.mail['return-path'].addr == "<>" - return false - end - if !self.mail['auto-submitted'].nil? - return false - end - return true - end - def normalise_content_type(content_type) # e.g. http://www.whatdotheyknow.com/request/93/response/250 if content_type == 'application/excel' or content_type == 'application/msexcel' or content_type == 'application/x-ms-excel' |