aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb10
-rw-r--r--app/models/user.rb6
-rw-r--r--app/views/request/_describe_state.rhtml2
-rw-r--r--app/views/request/show.rhtml2
4 files changed, 15 insertions, 5 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 8259c401b..96e713655 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.113 2008-09-22 14:13:40 francis Exp $
+# $Id: request_controller.rb,v 1.114 2008-09-24 12:59:27 francis Exp $
class RequestController < ApplicationController
@@ -29,6 +29,9 @@ class RequestController < ApplicationController
@last_info_request_event_id = last_event.nil? ? nil : last_event.id
@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?
+
# Sidebar stuff
limit = 3
# ... requests that have similar imporant terms
@@ -194,7 +197,10 @@ class RequestController < ApplicationController
def describe_state
@info_request = InfoRequest.find(params[:id])
- if not @info_request.awaiting_description
+ # 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?
+
+ if !@info_request.awaiting_description && !@requires_admin_describe
flash[:notice] = "The status of this request is up to date."
if !params[:submitted_describe_state].nil?
flash[:notice] = "The status of this request was made up to date elsewhere while you were filling in the form."
diff --git a/app/models/user.rb b/app/models/user.rb
index 558c2ad3f..ba7e6f72b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -22,7 +22,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.71 2008-09-22 22:16:37 francis Exp $
+# $Id: user.rb,v 1.72 2008-09-24 12:59:27 francis Exp $
require 'digest/sha1'
@@ -187,6 +187,10 @@ class User < ActiveRecord::Base
def owns_every_request?
self.admin_level == 'super'
end
+ # Can the user edit status of requires_admin requests from main website?
+ def requires_admin_power?
+ self.admin_level == 'super'
+ end
# Does the user get "(admin)" links on each page on the main site?
def admin_page_links?
self.admin_level == 'super'
diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml
index a4f573e10..0c29ca01c 100644
--- a/app/views/request/_describe_state.rhtml
+++ b/app/views/request/_describe_state.rhtml
@@ -1,4 +1,4 @@
-<% if @is_owning_user %>
+<% 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>
<hr>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 02eb820e6..b77e3c464 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -1,6 +1,6 @@
<% @title = h(@info_request.title) %>
-<% if @info_request.awaiting_description %>
+<% if @info_request.awaiting_description || @requires_admin_describe %>
<div class="describe_state_form">
<%= render :partial => 'describe_state', :locals => { :id_suffix => "1" } %>
</div>