aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_general_controller.rb1
-rw-r--r--app/controllers/request_controller.rb11
-rw-r--r--app/models/info_request.rb10
-rw-r--r--app/models/request_mailer.rb2
-rw-r--r--app/views/admin_general/index.rhtml14
-rw-r--r--app/views/request/_sidebar.rhtml11
-rw-r--r--app/views/request/show.rhtml2
-rw-r--r--config/routes.rb1
-rw-r--r--db/migrate/114_add_attention_requested_flag_to_info_requests.rb13
-rw-r--r--public/stylesheets/main.css2
10 files changed, 62 insertions, 5 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 43ca4f093..c83ae0f37 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -30,6 +30,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")
+ @attention_requests = InfoRequest.find(:all, :select => '*, ' + InfoRequest.last_event_time_clause + ' as last_event_time', :conditions => ["described_state = 'attention_requested'"], :order => "last_event_time")
@blank_contacts = PublicBody.find(:all, :conditions => ["request_email = ''"], :order => "updated_at")
@old_unclassified = InfoRequest.find_old_unclassified(:limit => 20,
:conditions => ["prominence = 'normal'"])
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index af142c530..06a84d99d 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -654,6 +654,17 @@ class RequestController < ApplicationController
end
end
+ def report_request
+ info_request = InfoRequest.find_by_url_title(params[:url_title])
+ if !info_request.attention_requested
+ info_request.set_described_state('attention_requested')
+ info_request.attention_requested = true # tells us if attention has ever been requested
+ info_request.save!
+ end
+ flash[:notice] = _("This request has been reported for administrator attention")
+ redirect_to request_url(info_request)
+ end
+
# special caching code so mime types are handled right
around_filter :cache_attachments, :only => [ :get_attachment, :get_attachment_as_html ]
def cache_attachments
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 1e55f92ae..4a70e365d 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -88,7 +88,8 @@ class InfoRequest < ActiveRecord::Base
'internal_review',
'error_message',
'requires_admin',
- 'user_withdrawn'
+ 'user_withdrawn',
+ 'attention_requested'
]
if @@custom_states_loaded
states += InfoRequest.theme_extra_states
@@ -503,7 +504,7 @@ public
# states which require administrator action (hence email administrators
# when they are entered, and offer state change dialog to them)
def InfoRequest.requires_admin_states
- return ['requires_admin', 'error_message']
+ return ['requires_admin', 'error_message', 'attention_requested']
end
def requires_admin?
@@ -511,6 +512,9 @@ public
return false
end
+ def can_have_attention_requested?
+ end
+
# change status, including for last event for later historical purposes
def set_described_state(new_state)
ActiveRecord::Base.transaction do
@@ -803,6 +807,8 @@ public
_("Delivery error")
elsif status == 'requires_admin'
_("Unusual response.")
+ elsif status == 'attention_requested'
+ _("Reported for administrator attention.")
elsif status == 'user_withdrawn'
_("Withdrawn by the requester.")
else
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index e336111ee..ee6220a47 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -48,7 +48,7 @@ class RequestMailer < ApplicationMailer
def requires_admin(info_request)
@from = info_request.user.name_and_email
@recipients = contact_from_name_and_email
- @subject = _("FOI response requires admin - ") + info_request.title
+ @subject = _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title)
url = main_url(request_url(info_request))
admin_url = request_admin_url(info_request)
@body = {:info_request => info_request, :url => url, :admin_url => admin_url }
diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.rhtml
index 1a4b8ba96..48bd7f694 100644
--- a/app/views/admin_general/index.rhtml
+++ b/app/views/admin_general/index.rhtml
@@ -46,6 +46,20 @@
</ul>
<% end %>
+<% if @attention_requests.size > 0 %>
+ <h3>Review requests which have been marked as requiring your attention by users (<%=@error_message_requests.size%> total)</h3>
+
+ <ul>
+ <% for @request in @attention_requests %>
+ <li>
+ <%= request_both_links(@request)%>
+ &ndash; <%=simple_date(@request.get_last_event.created_at)%>
+ </li>
+ <% end %>
+ </ul>
+<% end %>
+
+
<% if @requires_admin_requests.size > 0 %>
<h3>These require administrator attention (<%=@requires_admin_requests.size%> total)</h3>
diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml
index 758387b09..c0708a36a 100644
--- a/app/views/request/_sidebar.rhtml
+++ b/app/views/request/_sidebar.rhtml
@@ -4,7 +4,16 @@
<% follower_count = TrackThing.count(:all, :conditions => ["info_request_id = ?", @info_request.id]) + 1 %>
<p><%= n_("There is %d person following this request", "There are %d people following this request", follower_count) % follower_count %></p>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => @info_request.user == @user, :location => 'sidebar' } %>
-
+ <% if @info_request.described_state != "attention_requested" %>
+ <h2><%= _('Offensive? Unsuitable?') %></h2>
+ <% if @info_request.attention_requested %>
+ <p><%= ('The site administrators have reviewed this request and consider it to be suitable for the website.') %></p>
+ <% else %>
+ <p><%= _('Requests for personal information and vexatious requests are not considered valid for FOI purposes (<a href="/help/about">read more</a>).') %>
+ <p><%= ('If you believe this request is not suitable, you can report it for attention by the site administrators') %></p>
+ <%= link_to _("Report this request"), report_path, :class => "link_button_green" %>
+ <% end %>
+ <% end %>
<h2><%= _("Act on what you've learnt") %></h2>
<div class="act_link">
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 611704ebe..036ef06dd 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -118,6 +118,8 @@
<% elsif @status == 'user_withdrawn' %>
<%= _('This request has been <strong>withdrawn</strong> by the person who made it.
There may be an explanation in the correspondence below.') %>
+ <% elsif @status == 'attention_requested' %>
+ <%= _('This request has been <strong>reported</strong> as needing administrator attention (perhaps because it is vexatious, or a request for personal information)') %>
<% else %>
<%= render :partial => 'general/custom_state_descriptions', :locals => { :status => @status } %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 0ebd3dbc8..698752218 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -66,6 +66,7 @@ ActionController::Routing::Routes.draw do |map|
request.upload_response "/upload/request/:url_title", :action => 'upload_response'
request.download_entire_request '/request/:url_title/download', :action => 'download_entire_request'
+ request.report '/request/:url_title/report', :action => 'report_request'
end
diff --git a/db/migrate/114_add_attention_requested_flag_to_info_requests.rb b/db/migrate/114_add_attention_requested_flag_to_info_requests.rb
new file mode 100644
index 000000000..48c98e5a9
--- /dev/null
+++ b/db/migrate/114_add_attention_requested_flag_to_info_requests.rb
@@ -0,0 +1,13 @@
+require 'digest/sha1'
+
+class AddAttentionRequestedFlagToInfoRequests < ActiveRecord::Migration
+ def self.up
+ add_column :info_requests, :attention_requested, :boolean, :default => false
+ end
+ def self.down
+ remove_column :info_requests, :attention_requested
+ end
+end
+
+
+
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index 4b12a637a..0c2239409 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -311,7 +311,7 @@ color:#A68C2E;
background-image:url(../images/navimg/status-icons-fail.png);
}
-.icon_not_held {
+.icon_not_held, .icon_attention_requested {
background-image:url(/images/status-not-held.png);
color:#A68C2E;
}