diff options
-rw-r--r-- | app/controllers/admin_general_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 11 | ||||
-rw-r--r-- | app/models/info_request.rb | 13 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 5 | ||||
-rw-r--r-- | app/views/admin_general/index.rhtml | 15 | ||||
-rw-r--r-- | app/views/admin_request/edit.rhtml | 1 | ||||
-rw-r--r-- | app/views/comment/new.rhtml | 4 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 1 | ||||
-rw-r--r-- | app/views/request/_describe_state.rhtml | 16 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 2 | ||||
-rw-r--r-- | todo.txt | 8 |
11 files changed, 65 insertions, 14 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb index d824f1a6d..b5958cd73 100644 --- a/app/controllers/admin_general_controller.rb +++ b/app/controllers/admin_general_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: admin_general_controller.rb,v 1.1 2009-01-29 12:28:45 francis Exp $ +# $Id: admin_general_controller.rb,v 1.2 2009-02-27 22:32:13 francis Exp $ class AdminGeneralController < AdminController def index @@ -17,6 +17,7 @@ class AdminGeneralController < AdminController # Tasks to do @requires_admin_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'requires_admin'"], :order => "last_event_time") + @error_message_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'error_message'"], :order => "last_event_time") @blank_contacts = PublicBody.find(:all, :conditions => ["request_email = ''"], :order => "updated_at") @ten_days_old_unclassified = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => [ "awaiting_description = ? and " + InfoRequest.last_event_time_clause + " < ? and prominence != 'backpage'", true, Time.now() - 10.days ], :order => "last_event_time") @holding_pen_messages = InfoRequest.holding_pen_request.incoming_messages diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 9aa87add3..9ca1855ef 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.147 2009-02-27 17:14:57 francis Exp $ +# $Id: request_controller.rb,v 1.148 2009-02-27 22:32:13 francis Exp $ class RequestController < ApplicationController @@ -31,7 +31,7 @@ class RequestController < ApplicationController @new_responses_count = @events_needing_description.select {|i| i.event_type == 'response'}.size # special case that an admin user can edit requires_admin requests - @requires_admin_describe = (@info_request.described_state == 'requires_admin') && !authenticated_user.nil? && authenticated_user.requires_admin_power? + @requires_admin_describe = (InfoRequest.requires_admin_states.include?(@info_request.described_state)) && !authenticated_user.nil? && authenticated_user.requires_admin_power? # Sidebar stuff limit = 3 @@ -231,7 +231,7 @@ class RequestController < ApplicationController end # special case that an admin user can edit requires_admin requests - @requires_admin_describe = (@info_request.described_state == 'requires_admin') && !authenticated_user.nil? && authenticated_user.requires_admin_power? + @requires_admin_describe = (InfoRequest.requires_admin_states.include?(@info_request.described_state)) && !authenticated_user.nil? && authenticated_user.requires_admin_power? if !@info_request.awaiting_description && !@requires_admin_describe flash[:notice] = "The status of this request is up to date." @@ -312,8 +312,11 @@ class RequestController < ApplicationController elsif @info_request.calculate_status == 'internal_review' flash[:notice] = "<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within 20 days, or be told if it will take longer (<a href=\"" + unhappy_url(@info_request) + "#internal_review\">details</a>).</p>" redirect_to request_url(@info_request) + elsif @info_request.calculate_status == 'error_message' + flash[:notice] = "<p>Thank you! We'll look into what happened and try and fix it up.</p><p>If the error was a delivery failure, and you can find an up to date FOI email address for the authority, please tell us using the form below.</p>" + redirect_to help_general_url(:action => 'contact') elsif @info_request.calculate_status == 'requires_admin' - flash[:notice] = "Please use the form below if you would like to tell us what is unusual about the response." + flash[:notice] = "Please use the form below to tell us more." redirect_to help_general_url(:action => 'contact') else raise "unknown calculate_status " + @info_request.calculate_status diff --git a/app/models/info_request.rb b/app/models/info_request.rb index d30967b1c..f7579c6d8 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -23,7 +23,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.165 2009-02-27 16:50:53 francis Exp $ +# $Id: info_request.rb,v 1.166 2009-02-27 22:32:13 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -59,6 +59,7 @@ class InfoRequest < ActiveRecord::Base 'successful', 'partially_successful', 'internal_review', + 'error_message', 'requires_admin', 'user_withdrawn' ] @@ -323,6 +324,12 @@ public return ir end + # states which require administrator action (hence email administrators + # when they are entered, and offer state change dialog to them) + def self.requires_admin_states + return ['requires_admin', 'error_message'] + end + # change status, including for last event for later historical purposes def set_described_state(new_state) ActiveRecord::Base.transaction do @@ -336,7 +343,7 @@ public self.calculate_event_states - if new_state == 'requires_admin' + if InfoRequest.requires_admin_states.include?(new_state) RequestMailer.deliver_requires_admin(self) end end @@ -656,6 +663,8 @@ public "Handled by post." elsif status == 'internal_review' "Awaiting internal review." + elsif status == 'error_message' + "Delivery error" elsif status == 'requires_admin' "Unusual response." elsif status == 'user_withdrawn' diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index f4a3849f3..291073273 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -21,7 +21,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.72 2009-02-09 09:51:53 francis Exp $ +# $Id: info_request_event.rb,v 1.73 2009-02-27 22:32:13 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -61,6 +61,7 @@ class InfoRequestEvent < ActiveRecord::Base 'successful', 'partially_successful', 'internal_review', + 'error_message', 'requires_admin', 'user_withdrawn' ] @@ -216,6 +217,8 @@ class InfoRequestEvent < ActiveRecord::Base return "Internal review acknowledgement" elsif status == 'user_withdrawn' return "Withdrawn by requester" + elsif status == 'error_message' + return "Delivery error" elsif status == 'requires_admin' return "Unusual response" end diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.rhtml index 7dce7373c..d15f619f1 100644 --- a/app/views/admin_general/index.rhtml +++ b/app/views/admin_general/index.rhtml @@ -45,8 +45,21 @@ </ul> <% end %> +<% if @error_message_requests.size > 0 %> + <h3>Fix these delivery and other errors (<%=@error_message_requests.size%> total)</h3> + + <ul> + <% for @request in @error_message_requests %> + <li> + <%= request_both_links(@request)%> + – <%=simple_date(@request.get_last_event.created_at)%> + </li> + <% end %> + </ul> +<% end %> + <% if @requires_admin_requests.size > 0 %> - <h3>Work out what to do with these unusual responses (a new category?) (<%=@requires_admin_requests.size%> total)</h3> + <h3>These require administrator attention (<%=@requires_admin_requests.size%> total)</h3> <ul> <% for @request in @requires_admin_requests %> diff --git a/app/views/admin_request/edit.rhtml b/app/views/admin_request/edit.rhtml index d00ec2c4c..7374042f1 100644 --- a/app/views/admin_request/edit.rhtml +++ b/app/views/admin_request/edit.rhtml @@ -25,6 +25,7 @@ 'successful', 'partially_successful', 'internal_review', + 'error_message', 'requires_admin', 'user_withdrawn' ]) %> diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.rhtml index a298b640a..faea07e30 100644 --- a/app/views/comment/new.rhtml +++ b/app/views/comment/new.rhtml @@ -51,10 +51,14 @@ Annotations are so anyone, including you, can help the requester with their requ <li> Advise on whether the <strong>rejection is legal</strong>, and how to complain about if not. </li> <% end %> +<% if [ 'error_message' ].include?(@info_request.described_state) %> + <li> You know what caused the error, and can <strong>suggest a solution</strong>, such as a working email address. </li> +<% end %> <% if [ 'requires_admin' ].include?(@info_request.described_state) %> <li> Your thoughts on what the WhatDoTheyKnow <strong>administrators</strong> should do about the request. </li> <% end %> + </ul> <p> diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index ed2be514b..0a9dd3e5c 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -133,6 +133,7 @@ <tr><td><strong><%=search_link('status:waiting_clarification')%></strong></td><td> The public authority would like part of the request explained </td></tr> <tr><td><strong><%=search_link('status:gone_postal')%></strong></td><td> The public authority would like to / has responded by post </td></tr> <tr><td><strong><%=search_link('status:internal_review')%></strong></td><td> Waiting for the public authority to complete an internal review of their handling of the request</td></tr> + <tr><td><strong><%=search_link('status:error_message')%></strong></td><td> Received an error message, such as delivery failure.</td></tr> <tr><td><strong><%=search_link('status:requires_admin')%></strong></td><td> A strange reponse, required attention by the WhatDoTheyKnow team </td></tr> <tr><td><strong><%=search_link('status:user_withdrawn')%></strong></td><td> The requester has abandoned this request for some reason </td></tr> </table> diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml index 15983eb78..d6e24c453 100644 --- a/app/views/request/_describe_state.rhtml +++ b/app/views/request/_describe_state.rhtml @@ -1,6 +1,6 @@ <% if @is_owning_user || @requires_admin_describe %> <% form_for(:incoming_message, @info_request, :url => describe_state_url(:id => @info_request.id)) do |f| %> - <h2>What is the status of this request now?</h2> + <h2>What best describes the status of this request now?</h2> <hr> <!------------------------------------------------> @@ -56,9 +56,19 @@ <hr> <!------------------------------------------------> <div> - <%= radio_button "incoming_message", "described_state", "requires_admin", :id => 'requires_admin' + id_suffix %> - <label for="requires_admin<%=id_suffix%>"><strong>None</strong> of the above</label> + <%= radio_button "incoming_message", "described_state", "error_message", :id => 'error_message' + id_suffix %> + <label for="error_message<%=id_suffix%>"> + I've received an <strong>error message</strong> + </label> </div> +<!-- <div> + <%= radio_button "incoming_message", "described_state", "requires_admin", :id => 'requires_admin' + id_suffix %> + <label for="requires_admin<%=id_suffix%>"> + <strong>None</strong> of the above + </label> + </div> --> + + <hr> <p> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 1993b77ce..4e001f9b8 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -109,6 +109,8 @@ The authority would like to / has <strong>responded by post</strong> to this request. <% elsif @status == 'internal_review' %> Waiting for an <strong>internal review</strong> by <%= public_body_link(@info_request.public_body) %> of their handling of this request. + <% elsif @status == 'error_message' %> + There was a <strong>delivery error</strong> or similar, which needs fixing by the WhatDoTheyKnow team. <% elsif @status == 'requires_admin' %> This request has had an unusual response, and <strong>requires attention</strong> from the WhatDoTheyKnow team. <% elsif @status == 'user_withdrawn' %> @@ -1,4 +1,7 @@ -check-recent-requests-sent works + +requires_admin_requests + +check-recent-requests-sent works (mails "check_recent_requests_have_been_sent") Write code to make sure the Return-Path is never foi@sandwich.org.uk (even if the Rails code breaks for Sendmail case in future botched Rails upgrades :) Maybe can use exim delivery log lines to do this? @@ -63,6 +66,7 @@ at all and that it might be spam. Links to "a response" from timeline aren't to right page any more. + Later ===== @@ -100,7 +104,7 @@ I have several email alerts set up. Is there any chance they could include part (or, preferably, all) of the search criterion in the Subject: line? :o) (Perhaps do it in the case when only one search criterion makes the mail) -Update annotation help text for new states like internal_review and gone_postal +Update annotation help text for new states like internal_review and gone_postal ./views/comment/new.rhtml Test data dumper that removes sensitive data, but lets trusted people play with whole database on their own machine without risk of compromise (for Tony) |