aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_request_controller.rb2
-rw-r--r--app/controllers/api_controller.rb5
-rwxr-xr-xapp/helpers/link_to_helper.rb8
-rw-r--r--app/views/comment/new.rhtml3
-rw-r--r--app/views/request/_after_actions.rhtml2
-rw-r--r--app/views/request/_correspondence.rhtml2
-rw-r--r--app/views/request/_describe_state.rhtml4
-rw-r--r--app/views/request/show.rhtml8
-rw-r--r--app/views/request/upload_response.rhtml67
-rw-r--r--app/views/track_mailer/event_digest.rhtml6
-rw-r--r--spec/views/request/_after_actions.rhtml_spec.rb2
-rw-r--r--spec/views/request/_describe_state.rhtml_spec.rb7
-rw-r--r--spec/views/request/show.rhtml_spec.rb2
13 files changed, 74 insertions, 44 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index fd1405319..ae4bb511a 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -28,7 +28,7 @@ class AdminRequestController < AdminController
@info_request = InfoRequest.find(params[:id])
# XXX is this *really* the only way to render a template to a
# variable, rather than to the response?
- vars = OpenStruct.new(:name_to => @info_request.user.name,
+ vars = OpenStruct.new(:name_to => @info_request.user_name,
:name_from => MySociety::Config.get("CONTACT_NAME", 'Alaveteli'),
:info_request => @info_request, :reason => params[:reason],
:info_request_url => 'http://' + MySociety::Config.get('DOMAIN') + request_url(@info_request),
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 4db07b4c9..718c31e6f 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -151,8 +151,9 @@ class ApiController < ApplicationController
mail = RequestMailer.create_external_response(request, body, sent_at, attachment_hashes)
request.receive(mail, mail.encoded, true)
end
-
- head :no_content
+ render :json => {
+ 'url' => make_url("request", request.url_title),
+ }
end
def body_request_events
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 1a86333b6..01332c5ab 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -93,6 +93,14 @@ module LinkToHelper
def user_link(user, cls=nil)
link_to h(user.name), user_url(user), :class => cls
end
+ def user_link_for_request(request, cls=nil)
+ if request.is_external?
+ request.external_user_name || _("Anonymous user")
+ else
+ link_to h(request.user.name), user_url(request.user), :class => cls
+ end
+ end
+
def user_link_absolute(user)
link_to h(user.name), main_url(user_url(user))
end
diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.rhtml
index cf9367b88..55155c8a2 100644
--- a/app/views/comment/new.rhtml
+++ b/app/views/comment/new.rhtml
@@ -69,6 +69,9 @@
<p>
<big><%= _('Annotations will be posted publicly here, and are
<strong>not</strong> sent to {{public_body_name}}.',:public_body_name=>h(@info_request.public_body.name)) %></big>
+ <% if @info_request.is_external? %>
+ <big><%= _('Note that the requester will not be notified about your annotation, because the request was published by {{public_body_name}} on their behalf.', :public_body_name => @info_request.public_body.name) %></big>
+ <% end %>
</p>
<%= render :partial => 'comment/comment_form', :locals => { :track_thing => @track_thing } %>
diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml
index 205b738de..02ed7c849 100644
--- a/app/views/request/_after_actions.rhtml
+++ b/app/views/request/_after_actions.rhtml
@@ -20,7 +20,7 @@
</div>
<div id="owner_actions">
- <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user.name)) %></strong>
+ <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user_name)) %></strong>
<ul>
<li>
diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml
index 9a198ad7d..36257991b 100644
--- a/app/views/request/_correspondence.rhtml
+++ b/app/views/request/_correspondence.rhtml
@@ -33,7 +33,7 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
<div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
<h2>
- <%= _("From:") %> <%=h @info_request.user.name %><br>
+ <%= _("From:") %> <%=h @info_request.user_name %><br>
<br><%= simple_date(info_request_event.created_at) %>
</h2>
diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml
index 71699835c..5b6004e81 100644
--- a/app/views/request/_describe_state.rhtml
+++ b/app/views/request/_describe_state.rhtml
@@ -104,9 +104,11 @@
<% elsif @old_unclassified %>
<%= render :partial => 'other_describe_state', :locals => {:id_suffix => id_suffix } %>
<% else %>
-<%= _('We don\'t know whether the most recent response to this request contains
+ <% if !@info_request.is_external? %>
+ <%= _('We don\'t know whether the most recent response to this request contains
information or not
&ndash;
if you are {{user_link}} please <a href="{{url}}">sign in</a> and let everyone know.',:user_link=>user_link(@info_request.user), :url=>signin_url(:r => request.request_uri)) %>
+ <% end %>
<% end %>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 27ad0700e..a7760ab19 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -27,7 +27,7 @@
<div id="left_column">
<h1><%=h(@info_request.title)%></h1>
- <% if @info_request.user.profile_photo %>
+ <% if !@info_request.is_external? && @info_request.user.profile_photo %>
<p class="user_photo_on_request">
<img src="<%= get_profile_photo_url(:url_name => @info_request.user.url_name) %>" alt="">
</p>
@@ -43,7 +43,7 @@
: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=>user_link(@info_request.user), :law_used_full=>h(@info_request.law_used_full)) %>
+ <%= _('{{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)) %>
<% end %>
</p>
@@ -61,7 +61,7 @@
<%= _('and update the status accordingly. Perhaps <strong>you</strong> might like to help out by doing that?') %>
<% else %>
<%= _('We\'re waiting for') %>
- <%= user_link(@info_request.user) %> <%= _('to read') %>
+ <%= 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 %>
@@ -104,7 +104,7 @@
<%= 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(@info_request.user)) %>
+ <%= _('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' %>
diff --git a/app/views/request/upload_response.rhtml b/app/views/request/upload_response.rhtml
index 38c3db268..0de96c5f3 100644
--- a/app/views/request/upload_response.rhtml
+++ b/app/views/request/upload_response.rhtml
@@ -1,45 +1,52 @@
-<% @title = "Respond to the FOI request '" + h(@info_request.title) + "' made by " + h(@info_request.user.name) %>
+<% @title = "Respond to the FOI request '" + h(@info_request.title) + "' made by " + h(@info_request.user_name) %>
-<%= foi_error_messages_for :comment %>
+<% if @info_request.is_external? %>
-<h1><%= _('Respond to the FOI request')%> '<%=request_link(@info_request)%>'<% _(' made by ')%><%=user_link(@info_request.user) %></h1>
+ <h1><%= _('This request was not made via {{site_name}}', :site_name => site_name) %></h1>
+ <p><%= _('Sorry - you cannot respond to this request via {{site_name}}, because this is a copy of the request originally at {{link_to_original_request}}.', :site_name => site_name, :link_to_original_request => link_to(@info_request.external_url, @info_request.external_url)) %></p>
-<p>
- <%= _('Your response will <strong>appear on the Internet</strong>, <a href="%s">read why</a> and answers to other questions.')% [help_officers_path] %>
-</p>
+<% else %>
-<h2><%= _('Respond by email')%></h2>
+ <%= foi_error_messages_for :comment %>
-<p><%= _('You should have received a copy of the request by email, and you can respond
-by <strong>simply replying</strong> to that email. For your convenience, here is the address:')%>
-<a href="mailto:<%=h @info_request.incoming_email%>"><%=h @info_request.incoming_email%></a>.
-<%= _('You may <strong>include attachments</strong>. If you would like to attach a
-file too large for email, use the form below.')%>
-</p>
+ <h1><%= _('Respond to the FOI request')%> '<%=request_link(@info_request)%>'<% _(' made by ')%><%=user_link(@info_request.user) %></h1>
+ <p>
+ <%= _('Your response will <strong>appear on the Internet</strong>, <a href="%s">read why</a> and answers to other questions.')% [help_officers_path] %>
+ </p>
-<h2><%= _('Respond using the web')%></h2>
+ <h2><%= _('Respond by email')%></h2>
-<p><%= _('Enter your response below. You may attach one file (use email, or
-<a href="%s">contact us</a> if you need more).')% [help_contact_path] %></p>
+ <p><%= _('You should have received a copy of the request by email, and you can respond
+ by <strong>simply replying</strong> to that email. For your convenience, here is the address:')%>
+ <a href="mailto:<%=h @info_request.incoming_email%>"><%=h @info_request.incoming_email%></a>.
+ <%= _('You may <strong>include attachments</strong>. If you would like to attach a
+ file too large for email, use the form below.')%>
+ </p>
-<% form_tag '', :id => 'upload_response_form', :multipart => true do %>
- <p>
- <label class="form_label" for="body"><% _('Response:')%></label>
- <%= text_area_tag :body, "", :rows => 10, :cols => 55 %>
- </p>
- <p>
- <label class="form_label" for="file_1"><% _('Attachment (optional):')%></label>
- <%= file_field_tag :file_1, :size => 35 %>
- </p>
+ <h2><%= _('Respond using the web')%></h2>
- <p>
- <%= hidden_field_tag 'submitted_upload_response', 1 %>
- <%= submit_tag "Upload FOI response" %>
- <%= _(' (<strong>patience</strong>, especially for large files, it may take a while!)')%>
- </p>
+ <p><%= _('Enter your response below. You may attach one file (use email, or
+ <a href="%s">contact us</a> if you need more).')% [help_contact_path] %></p>
+ <% form_tag '', :id => 'upload_response_form', :multipart => true do %>
+ <p>
+ <label class="form_label" for="body"><% _('Response:')%></label>
+ <%= text_area_tag :body, "", :rows => 10, :cols => 55 %>
+ </p>
+
+ <p>
+ <label class="form_label" for="file_1"><% _('Attachment (optional):')%></label>
+ <%= file_field_tag :file_1, :size => 35 %>
+ </p>
+
+ <p>
+ <%= hidden_field_tag 'submitted_upload_response', 1 %>
+ <%= submit_tag "Upload FOI response" %>
+ <%= _(' (<strong>patience</strong>, especially for large files, it may take a while!)')%>
+ </p>
+ <% end %>
<% end %>
diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml
index 089b778f8..2c2e3c957 100644
--- a/app/views/track_mailer/event_digest.rhtml
+++ b/app/views/track_mailer/event_digest.rhtml
@@ -18,14 +18,14 @@
# e.g. Julian Burgess sent a request to Royal Mail Group (15 May 2008)
if event.event_type == 'response'
url = main_url(incoming_message_url(event.incoming_message))
- main_text += _("{{public_body}} sent a response to {{user_name}}", :public_body => event.info_request.public_body.name, :user_name => event.info_request.user.name)
+ main_text += _("{{public_body}} sent a response to {{user_name}}", :public_body => event.info_request.public_body.name, :user_name => event.info_request.user_name)
elsif event.event_type == 'followup_sent'
url = main_url(outgoing_message_url(event.outgoing_message))
- main_text += _("{{user_name}} sent a follow up message to {{public_body}}", :user_name => event.info_request.user.name, :public_body => event.info_request.public_body.name)
+ main_text += _("{{user_name}} sent a follow up message to {{public_body}}", :user_name => event.info_request.user_name, :public_body => event.info_request.public_body.name)
elsif event.event_type == 'sent'
# this is unlikely to happen in real life, but happens in the test code
url = main_url(outgoing_message_url(event.outgoing_message))
- main_text += _("{{user_name}} sent a request to {{public_body}}", :user_name => event.info_request.user.name, :public_body => event.info_request.public_body.name)
+ main_text += _("{{user_name}} sent a request to {{public_body}}", :user_name => event.info_request.user_name, :public_body => event.info_request.public_body.name)
elsif event.event_type == 'comment'
url = main_url(comment_url(event.comment))
main_text += _("{{user_name}} added an annotation", :user_name => event.comment.user.name)
diff --git a/spec/views/request/_after_actions.rhtml_spec.rb b/spec/views/request/_after_actions.rhtml_spec.rb
index 6a56e7a71..d04db3fc2 100644
--- a/spec/views/request/_after_actions.rhtml_spec.rb
+++ b/spec/views/request/_after_actions.rhtml_spec.rb
@@ -9,6 +9,8 @@ describe 'when displaying actions that can be taken with regard to a request' do
:url_name => 'test_user')
@mock_request = mock_model(InfoRequest, :title => 'test request',
:user => @mock_user,
+ :user_name => @mock_user.name,
+ :is_external? => false,
:public_body => @mock_body,
:url_title => 'test_request')
assigns[:info_request] = @mock_request
diff --git a/spec/views/request/_describe_state.rhtml_spec.rb b/spec/views/request/_describe_state.rhtml_spec.rb
index ccf653b1b..18778d5d2 100644
--- a/spec/views/request/_describe_state.rhtml_spec.rb
+++ b/spec/views/request/_describe_state.rhtml_spec.rb
@@ -18,7 +18,12 @@ describe 'when showing the form for describing the state of a request' do
before do
@mock_user = mock_model(User, :name => 'test user', :url_name => 'test_user')
- @mock_request = mock_model(InfoRequest, :described_state => '', :user => @mock_user)
+ @mock_request = mock_model(InfoRequest,
+ :described_state => '',
+ :user => @mock_user,
+ :user_name => @mock_user.name,
+ :is_external? => false
+ )
assigns[:info_request] = @mock_request
end
diff --git a/spec/views/request/show.rhtml_spec.rb b/spec/views/request/show.rhtml_spec.rb
index ef7d1a47c..4429e9e58 100644
--- a/spec/views/request/show.rhtml_spec.rb
+++ b/spec/views/request/show.rhtml_spec.rb
@@ -15,6 +15,8 @@ describe 'when viewing an information request' do
:law_used_full => 'Freedom of Information',
:public_body => @mock_body,
:user => @mock_user,
+ :user_name => @mock_user.name,
+ :is_external? => false,
:calculate_status => 'waiting_response',
:date_response_required_by => Date.today,
:prominence => 'normal')