aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/request/show.rhtml42
-rw-r--r--spec/controllers/request_controller_spec.rb12
2 files changed, 33 insertions, 21 deletions
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index a7760ab19..47fdb3693 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -35,57 +35,57 @@
<p class="subtitle">
<% if !@user.nil? && @user.admin_page_links? %>
- <%= _('{{user}} (<a href="{{user_admin_url}}">admin</a>) made this {{law_used_full}} request (<a href="{{request_admin_url}}">admin</a>) to {{public_body_link}} (<a href="{{public_body_admin_url}}">admin</a>)',
- :user => user_link(@info_request.user),
+ <%= _('{{user}} ({{user_admin_link}}) made this {{law_used_full}} request (<a href="{{request_admin_url}}">admin</a>) to {{public_body_link}} (<a href="{{public_body_admin_url}}">admin</a>)',
+ :user => @info_request.is_external? ? @info_request.user_name : user_link(@info_request.user),
:law_used_full => h(@info_request.law_used_full),
- :user_admin_url => user_admin_url(@info_request.user),
+ :user_admin_link => @info_request.is_external? ? _('an external user') : link_to(_('admin'), user_admin_link(@info_request.user)),
:request_admin_url => request_admin_url(@info_request),
:public_body_link => public_body_link(@info_request.public_body),
:public_body_admin_url => public_body_admin_url(@info_request.public_body)) %>
<% else %>
<%= _('{{user}} made this {{law_used_full}} request',:user=>@info_request.user.nil? ? @info_request.user_name : user_link(@info_request.user), :law_used_full=>h(@info_request.law_used_full)) %>
- <%= _('to {{public_body}}',:public_body=>public_body_link(@info_request.public_body)) %>
+ <%= _('to {{public_body}}',:public_body=>public_body_link(@info_request.public_body)) %>
<% end %>
</p>
<p id="request_status" class="request_icon_line icon_<%= @info_request.calculate_status %>">
<% if @info_request.awaiting_description %>
<% if @is_owning_user %>
- <%= _('Please <strong>answer the question above</strong> so we know whether the ')%>
+ <%= _('Please <strong>answer the question above</strong> so we know whether the ')%>
<%= MySociety::Format.fancy_pluralize(@new_responses_count, 'recent response contains', 'recent responses contain') %> <%= _('useful information.') %>
<% else %>
<%= _('This request has an <strong>unknown status</strong>.') %>
<% if @old_unclassified %>
- <%= _('We\'re waiting for someone to read') %>
+ <%= _('We\'re waiting for someone to read') %>
<%= MySociety::Format.fancy_pluralize(@new_responses_count, 'a recent response', 'recent responses') %>
<%= _('and update the status accordingly. Perhaps <strong>you</strong> might like to help out by doing that?') %>
<% else %>
<%= _('We\'re waiting for') %>
- <%= user_link_for_request(@info_request) %> <%= _('to read') %>
- <%= MySociety::Format.fancy_pluralize(@new_responses_count, 'a recent response', 'recent responses') %>
+ <%= user_link_for_request(@info_request) %> <%= _('to read') %>
+ <%= MySociety::Format.fancy_pluralize(@new_responses_count, 'a recent response', 'recent responses') %>
<%= _('and update the status.') %>
<% end %>
<% end %>
<% elsif @status == 'waiting_response' %>
- <%= _('Currently <strong>waiting for a response</strong> from {{public_body_link}}, they must respond promptly and', :public_body_link=> public_body_link(@info_request.public_body)) %>
+ <%= _('Currently <strong>waiting for a response</strong> from {{public_body_link}}, they must respond promptly and', :public_body_link=> public_body_link(@info_request.public_body)) %>
<% if @info_request.public_body.is_school? %>
<%= _('in term time') %>
<% else %>
- <%= _('normally') %>
+ <%= _('normally') %>
<% end %>
<%= _('no later than') %> <strong><%= simple_date(@info_request.date_response_required_by) %></strong>
(<%= link_to _("details"), "/help/requesting#quickly_response" %>).
<% elsif @status == 'waiting_response_overdue' %>
<%= _('Response to this request is <strong>delayed</strong>.') %>
- <%= _('By law, {{public_body_link}} should normally have responded <strong>promptly</strong> and',:public_body_link=>public_body_link(@info_request.public_body)) %>
+ <%= _('By law, {{public_body_link}} should normally have responded <strong>promptly</strong> and',:public_body_link=>public_body_link(@info_request.public_body)) %>
<% if @info_request.public_body.is_school? %>
- <%= _('in term time') %>
+ <%= _('in term time') %>
<% end %>
<%= _('by') %> <strong><%= simple_date(@info_request.date_response_required_by) %></strong>
- (<%= _('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response'] %>)
+ (<%= _('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response'] %>)
<% elsif @status == 'waiting_response_very_overdue' %>
- <%= _('Response to this request is <strong>long overdue</strong>.') %>
- <%= _('By law, under all circumstances, {{public_body_link}} should have responded by now',:public_body_link => public_body_link(@info_request.public_body)) %>
+ <%= _('Response to this request is <strong>long overdue</strong>.') %>
+ <%= _('By law, under all circumstances, {{public_body_link}} should have responded by now',:public_body_link => public_body_link(@info_request.public_body)) %>
(<%= _('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response'] %>).
<%= _('You can <strong>complain</strong> by') %>
<%= link_to _("requesting an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>.
@@ -99,25 +99,25 @@
<%= _('The request was <strong>partially successful</strong>.') %>
<% elsif @status == 'waiting_clarification' %>
<% if @is_owning_user %>
- <%=h @info_request.public_body.name %> <%= _('is <strong>waiting for your clarification</strong>.') %>
+ <%=h @info_request.public_body.name %> <%= _('is <strong>waiting for your clarification</strong>.') %>
<%= _('Please') %>
<%= link_to _("send a follow up message"), respond_to_last_url(@info_request) + '#followup' %>.
<% else %>
- <%= _('The request is <strong>waiting for clarification</strong>.') %>
- <%= _('If you are {{user_link}}, please',:user_link=>user_link_for_request(@info_request)) %>
+ <%= _('The request is <strong>waiting for clarification</strong>.') %>
+ <%= _('If you are {{user_link}}, please',:user_link=>user_link_for_request(@info_request)) %>
<%= link_to _("sign in"), signin_url(:r => request.request_uri) %> <%= _('to send a follow up message.') %>
<% end %>
<% elsif @status == 'gone_postal' %>
<%= _('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}} of their handling of this request.',:public_body_link=>public_body_link(@info_request.public_body)) %>
+ <%= _('Waiting for an <strong>internal review</strong> by {{public_body_link}} of their handling of this request.',:public_body_link=>public_body_link(@info_request.public_body)) %>
<% elsif @status == 'error_message' %>
<%= _('There was a <strong>delivery error</strong> or similar, which needs fixing by the {{site_name}} team.', :site_name=>site_name) %>
<% elsif @status == 'requires_admin' %>
<%= _('This request has had an unusual response, and <strong>requires attention</strong> from the {{site_name}} team.', :site_name=>site_name) %>
<% 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.') %>
+ <%= _('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)') %>
<% elsif @status == 'vexatious' %>
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index dc970bf5f..b220d05f3 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -233,6 +233,18 @@ describe RequestController, "when showing one request" do
response.should redirect_to(:action => 'show', :url_title => info_requests(:naughty_chicken_request).url_title)
end
+ describe 'when showing an external request' do
+
+ it 'should be successful with no logged in user' do
+ get :show, { :url_title => 'balalas' }, { :user_id => nil }
+ response.should be_success
+ end
+
+ it 'should be successful when logged in as an admin user' do
+ get :show, { :url_title => 'balalas' }, { :user_id => users(:admin_user).id }
+ response.should be_success
+ end
+ end
describe 'when handling an update_status parameter' do
it 'should assign the "update status" flag to the view as true if the parameter is present' do