diff options
author | francis <francis> | 2008-02-21 20:10:21 +0000 |
---|---|---|
committer | francis <francis> | 2008-02-21 20:10:21 +0000 |
commit | 40d906d08d007c9cb81cbe3c4e2ee23b0894d2be (patch) | |
tree | afb367c1fe09024fcf12b3050ceda51d8d5cf4f8 | |
parent | 2b82914ae6dd30d9f3726e26f59dd3172b837523 (diff) |
Add new state to indicate that a response is not in a known category.
-rw-r--r-- | app/controllers/request_controller.rb | 5 | ||||
-rw-r--r-- | app/models/info_request.rb | 9 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 5 | ||||
-rw-r--r-- | app/models/request_mailer.rb | 28 | ||||
-rw-r--r-- | app/views/request/_describe_state.rhtml | 3 | ||||
-rw-r--r-- | app/views/request/_request_listing.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/request_mailer/requires_admin.rhtml | 9 | ||||
-rw-r--r-- | todo.txt | 14 |
9 files changed, 61 insertions, 16 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 288a4ef7b..561c95b59 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.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_controller.rb,v 1.55 2008-02-21 19:05:00 francis Exp $ +# $Id: request_controller.rb,v 1.56 2008-02-21 20:10:21 francis Exp $ class RequestController < ApplicationController @@ -177,6 +177,9 @@ class RequestController < ApplicationController elsif @info_request.calculate_status == 'waiting_clarification' flash[:notice] = "Please write your follow up message containing the necessary clarifications below." redirect_to show_response_url(:id => @info_request.id, :incoming_message_id => @events_needing_description[-1].params[:incoming_message_id]) + elsif @info_request.calculate_status == 'requires_admin' + flash[:notice] = "Thanks! The foi.mysociety.org team have been notified." + redirect_to show_request_url(:id => @info_request) else raise "unknown calculate_status " + @info_request.calculate_status end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 5a352026e..43b37a454 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.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: info_request.rb,v 1.41 2008-02-15 11:18:55 francis Exp $ +# $Id: info_request.rb,v 1.42 2008-02-21 20:10:21 francis Exp $ require 'digest/sha1' @@ -44,7 +44,8 @@ class InfoRequest < ActiveRecord::Base 'waiting_clarification', 'rejected', 'successful', - 'partially_successful' + 'partially_successful', + 'requires_admin' ] validates_inclusion_of :prominence, :in => [ @@ -135,6 +136,10 @@ public last_event.save! self.save! end + + if new_state == 'requires_admin' + RequestMailer.deliver_requires_admin(self) + end end # Work out what the situation of the request is diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index a8c2c7f50..c89f1c720 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -16,7 +16,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.15 2008-02-15 11:18:55 francis Exp $ +# $Id: info_request_event.rb,v 1.16 2008-02-21 20:10:21 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -40,7 +40,8 @@ class InfoRequestEvent < ActiveRecord::Base 'waiting_clarification', 'rejected', 'successful', - 'partially_successful' + 'partially_successful', + 'requires_admin' ] # We store YAML version of parameters in the database diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 7dfbfc315..515008209 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.21 2008-02-13 08:59:37 francis Exp $ +# $Id: request_mailer.rb,v 1.22 2008-02-21 20:10:21 francis Exp $ class RequestMailer < ApplicationMailer @@ -13,6 +13,8 @@ class RequestMailer < ApplicationMailer # they shouldn't, and this might help. (Have had mysterious cases of a # reply coming in duplicate from a public body to both From and envelope # from) + + # Email to public body requesting info def initial_request(info_request, outgoing_message) @from = info_request.incoming_name_and_email headers 'Sender' => info_request.envelope_name_and_email, @@ -23,6 +25,7 @@ class RequestMailer < ApplicationMailer :contact_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost') } end + # Later message to public body regarding existing request def followup(info_request, outgoing_message, incoming_message_followup) @from = info_request.incoming_name_and_email headers 'Sender' => info_request.envelope_name_and_email, @@ -34,6 +37,7 @@ class RequestMailer < ApplicationMailer :contact_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost') } end + # Incoming message arrived at FOI address, but hasn't got To:/CC: of valid request def bounced_message(email) @from = contact_from_name_and_email @recipients = @from @@ -41,6 +45,18 @@ class RequestMailer < ApplicationMailer email.setup_forward(self) end + # An FOI response is outside the scope of the system, and needs admin attention + def requires_admin(info_request) + @from = contact_from_name_and_email + @recipients = @from + @subject = "Unusual FOI response, requires admin attention" + # XXX these are repeats of things in helpers/link_to_helper.rb, and shouldn't be + url = show_request_url(:id => info_request) + admin_url = MySociety::Config.get("ADMIN_BASE_URL", "/admin/") + 'request/show/' + info_request.id.to_s + @body = {:info_request => info_request, :url => url, :admin_url => admin_url } + end + + # Tell the requester that a new response has arrived def new_response(info_request, incoming_message) post_redirect = PostRedirect.new( :uri => describe_state_url(:id => info_request.id), @@ -54,9 +70,10 @@ class RequestMailer < ApplicationMailer @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url } end - # Copy of function from action_mailer/base.rb, which passes the - # raw_email to the member function, as we want to record it. - # script/mailin calls this function. + # Class function, called by script/mailin with all incoming responses. + # [ This is a copy (Monkeypatch!) of function from action_mailer/base.rb, + # but which additionally passes the raw_email to the member function, as we + # want to record it. ] def self.receive(raw_email) logger.info "Received mail:\n #{raw_email}" unless logger.nil? mail = TMail::Mail.parse(raw_email) @@ -64,6 +81,7 @@ class RequestMailer < ApplicationMailer new.receive(mail, raw_email) end + # Member function, called on the new class made in self.receive above def receive(email, raw_email) # Find which info requests the email is for reply_info_requests = [] @@ -80,7 +98,7 @@ class RequestMailer < ApplicationMailer RequestMailer.deliver_bounced_message(email) end - # Send the message to each request + # Send the message to each request, to be archived with it for reply_info_request in reply_info_requests reply_info_request.receive(email, raw_email, false) end diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml index d1bfb1d95..b16955033 100644 --- a/app/views/request/_describe_state.rhtml +++ b/app/views/request/_describe_state.rhtml @@ -16,6 +16,9 @@ <br> <%= radio_button "incoming_message", "described_state", "partially_successful" %> <label for="incoming_message_described_state_partially_successful">I've received <strong>some of the information</strong> that I asked for</label> + <br> + <%= radio_button "incoming_message", "described_state", "requires_admin" %> + <label for="incoming_message_described_state_requires_admin"><strong>None</strong> of the above - e.g. add a new option here</label> </p> <p>Filling this in each time you get a new response helps us track the progress of your request. </p> diff --git a/app/views/request/_request_listing.rhtml b/app/views/request/_request_listing.rhtml index 35300929e..623ccf535 100644 --- a/app/views/request/_request_listing.rhtml +++ b/app/views/request/_request_listing.rhtml @@ -23,6 +23,8 @@ Successful. <% elsif status == 'waiting_clarification' %> Waiting clarification. + <% elsif status == 'requires_admin' %> + Unusual response. <% else %> <% raise "unknown status " + status %> <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 74dd15239..d4e6ddb22 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -51,6 +51,8 @@ <%= user_link(@info_request.user) %>, please <%= link_to "sign in", signin_url(:r => request.request_uri) %> to send a follow up message. <% end %> + <% elsif @status == 'requires_admin' %> + This request has had an unusual response, and <strong>requires attention</strong> from the foi.mysociety.org team. <% else %> <% raise "unknown status " + @status %> <% end %> diff --git a/app/views/request_mailer/requires_admin.rhtml b/app/views/request_mailer/requires_admin.rhtml new file mode 100644 index 000000000..209e2f334 --- /dev/null +++ b/app/views/request_mailer/requires_admin.rhtml @@ -0,0 +1,9 @@ +A user has reported an FOI response as being unusual, or out of the scope of +the system. Take a look, and contact the user to let them know what you are +going to do about it. + +Request '<%=@info_request.title%>': +<%= @url %> + +Administration URL: +<%= @admin_url %> @@ -14,16 +14,16 @@ BAILII - relationship with law courts, robots.txt ? Status of messages stuff ======================== -Status inputting: - cope with "other" case when something is both (e.g. received some AND clarify) - Alert somewhere if working days table not up to date +Status inputting: + Cope with "other" case when something is both (e.g. received some AND clarify) + We don't have "this is an evil techy weird bounce" as option for state of message + Response asks to be private + Adam's woes: http://foi.mysociety.org/request/18/response/31 -- Renders badly -- No doubt leaks email address via download.bin :( -- We don't have "this is an evil techy weird bounce" as option for state of message + - No doubt leaks email address via download.bin :( And Tom's woes: http://foi.mysociety.org/request/8 @@ -162,7 +162,9 @@ Skipped: Office of the Leader of the House of Commons Tricky: * Ministry of Defence + maybe use public@ministers.mod.uk from http://www.number-10.gov.uk/output/Page934.asp and FOE * Department for Transport + just use FAX9643@dft.gsi.gov.uk from http://www.dft.gov.uk/contact ? Also DfT :( http://www.dft.gov.uk/foi/whatyouneedtoknow/foionlinefrm Ones that require form: |