diff options
-rw-r--r-- | app/models/incoming_message.rb | 4 | ||||
-rw-r--r-- | app/models/info_request.rb | 6 | ||||
-rw-r--r-- | app/models/public_body.rb | 10 | ||||
-rw-r--r-- | app/models/request_mailer.rb | 4 | ||||
-rw-r--r-- | app/views/admin_public_body/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/followup_bad.rhtml | 12 |
6 files changed, 27 insertions, 11 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 30fb59582..43fec24c1 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.215 2009-09-07 19:47:18 francis Exp $ +# $Id: incoming_message.rb,v 1.216 2009-09-08 23:48:29 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel @@ -428,7 +428,7 @@ class IncomingMessage < ActiveRecord::Base # XXX can later display some of these special emails as actual emails, # if they are public anyway. For now just be precautionary and only # put in descriptions of them in square brackets. - if self.info_request.public_body.is_requestable? + if self.info_request.public_body.is_followupable? text = text.gsub(self.info_request.public_body.request_email, "[" + self.info_request.public_body.short_or_long_name + " request email]") end text = text.gsub(self.info_request.incoming_email, "[FOI #" + self.info_request.id.to_s + " email]") diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 2cf3a08b4..3cb0be78d 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -24,7 +24,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.203 2009-09-07 17:31:38 francis Exp $ +# $Id: info_request.rb,v 1.204 2009-09-08 23:48:29 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -560,8 +560,8 @@ public def recipient_email return self.public_body.request_email end - def recipient_email_valid? - return self.public_body.is_requestable? + def recipient_email_valid_for_followup? + return self.public_body.is_followupable? end def recipient_name_and_email return TMail::Address.address_from_name_and_email(self.law_used_short + " requests at " + self.public_body.short_or_long_name, self.recipient_email).to_s diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 307c7f6b5..894038853 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -26,7 +26,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.152 2009-09-08 03:07:06 francis Exp $ +# $Id: public_body.rb,v 1.153 2009-09-08 23:48:29 francis Exp $ require 'csv' require 'set' @@ -190,6 +190,14 @@ class PublicBody < ActiveRecord::Base end return !self.request_email.empty? && self.request_email != 'blank' end + # Strict superset of is_requestable? + def is_followupable? + if self.request_email.nil? + return false + end + return !self.request_email.empty? && self.request_email != 'blank' + end + # Also used as not_followable_reason def not_requestable_reason if self.defunct? return 'defunct' diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index f4a7b6448..d1770df3f 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.84 2009-09-08 04:12:09 francis Exp $ +# $Id: request_mailer.rb,v 1.85 2009-09-08 23:48:29 francis Exp $ class RequestMailer < ApplicationMailer @@ -69,7 +69,7 @@ class RequestMailer < ApplicationMailer # Whether we have a valid email address for a followup def RequestMailer.is_followupable?(info_request, incoming_message_followup) if incoming_message_followup.nil? || !incoming_message_followup.valid_to_reply_to? - return info_request.recipient_email_valid? + return info_request.recipient_email_valid_for_followup? else # email has been checked in incoming_message_followup.valid_to_reply_to? above return true diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml index 7f5682d38..c1292c63a 100644 --- a/app/views/admin_public_body/show.rhtml +++ b/app/views/admin_public_body/show.rhtml @@ -14,7 +14,7 @@ <% elsif column.name == 'request_email' and !column.name.empty? %> <%= link_to(h(@public_body.send(column.name)), "mailto:" + @public_body.send(column.name)) %> <% if !@public_body.is_requestable? %> - (not requestable due to: <%=h @public_body.not_requestable_reason %>) + (not requestable due to: <%=h @public_body.not_requestable_reason %><% if @public_body.is_followupable? %>; but followupable<% end %>) <% end %> <% else %> <%=h @public_body.send(column.name) %> diff --git a/app/views/request/followup_bad.rhtml b/app/views/request/followup_bad.rhtml index c6d9c88dc..ca314afcb 100644 --- a/app/views/request/followup_bad.rhtml +++ b/app/views/request/followup_bad.rhtml @@ -8,10 +8,18 @@ <% if @reason == 'not_apply' %> <!-- we should never get here, but just in case give a sensible message --> - <p>Freedom of Information law no longer applies to <%=h @info_request.public_body.name %>.</p> + <p>Freedom of Information law no longer applies to <%=h @info_request.public_body.name %>. + From the request page, try replying to a particular message, rather than sending + a general followup. If you need to make a general followup, and know + an email which will go to the right place, please <a href="/help/contact">send it to us</a>. + </p> <% elsif @reason == 'defunct' %> <!-- we should never get here, but just in case give a sensible message --> - <p><%=h @info_request.public_body.name %> no longer exists.</p> + <p><%=h @info_request.public_body.name %> no longer exists. If you are trying to make + From the request page, try replying to a particular message, rather than sending + a general followup. If you need to make a general followup, and know + an email which will go to the right place, please <a href="/help/contact">send it to us</a>. + </p> <% elsif @reason == 'bad_contact' %> <p>We do not have a working <%=h @info_request.law_used_full %> address for <%=h @info_request.public_body.name %>. You may be able to find |