aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb16
-rw-r--r--app/models/incoming_message.rb4
-rw-r--r--app/models/info_request.rb12
-rw-r--r--app/views/public_body/_alphabet.html.erb2
-rw-r--r--app/views/public_body/_body_listing_single.html.erb10
-rw-r--r--app/views/public_body/show.html.erb43
-rw-r--r--app/views/request/_sidebar.html.erb2
-rw-r--r--app/views/request/similar.html.erb15
8 files changed, 60 insertions, 44 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 42693f867..0c1d9880c 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -150,12 +150,6 @@ class RequestController < ApplicationController
:offset => (@page - 1) * @per_page, :limit => @per_page, :collapse_by_prefix => 'request_collapse')
@matches_estimated = @xapian_object.matches_estimated
@show_no_more_than = (@matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @matches_estimated
-
- if (@page > 1)
- @page_desc = " (page " + @page.to_s + ")"
- else
- @page_desc = ""
- end
end
def list
@@ -417,12 +411,22 @@ class RequestController < ApplicationController
end
# Make the state change
+ event = info_request.log_event("status_update",
+ { :user_id => authenticated_user.id,
+ :old_described_state => info_request.described_state,
+ :described_state => described_state,
+ })
+
info_request.set_described_state(described_state, authenticated_user, message)
# If you're not the *actual* requester. e.g. you are playing the
# classification game, or you're doing this just because you are an
# admin user (not because you also own the request).
if !info_request.is_actual_owning_user?(authenticated_user)
+ # Create a classification event for league tables
+ RequestClassification.create!(:user_id => authenticated_user.id,
+ :info_request_event_id => event.id)
+
# Don't give advice on what to do next, as it isn't their request
if session[:request_game]
flash[:notice] = _('Thank you for updating the status of the request \'<a href="{{url}}">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(info_request.title), :url=>CGI.escapeHTML(request_path(info_request)))
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 4910d43f4..ae3c3b407 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -258,7 +258,7 @@ class IncomingMessage < ActiveRecord::Base
# Used by binary_mask_stuff - replace text in place
def _binary_mask_stuff_internal!(text)
# Keep original size, so can check haven't resized it
- orig_size = text.size
+ orig_size = text.mb_chars.size
# Replace ASCII email addresses...
text.gsub!(MySociety::Validate.email_find_regexp) do |email|
@@ -293,7 +293,7 @@ class IncomingMessage < ActiveRecord::Base
# Replace censor items
self.info_request.apply_censor_rules_to_binary!(text)
- raise "internal error in binary_mask_stuff" if text.size != orig_size
+ raise "internal error in binary_mask_stuff" if text.mb_chars.size != orig_size
return text
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 46c247fa9..8f15a4ea4 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -584,16 +584,6 @@ public
end
unless set_by.nil? || is_actual_owning_user?(set_by) || described_state == 'attention_requested'
- # Log the status change by someone other than the requester
- event = log_event("status_update",
- { :user_id => set_by.id,
- :old_described_state => old_described_state,
- :described_state => described_state,
- })
- # Create a classification event for league tables
- RequestClassification.create!(:user_id => set_by.id,
- :info_request_event_id => event.id)
-
RequestMailer.old_unclassified_updated(self).deliver if !is_external?
end
end
@@ -646,7 +636,7 @@ public
event.save!
end
curr_state = nil
- elsif !curr_state.nil? && (event.event_type == 'followup_sent' || event.event_type == 'sent') && !event.described_state.nil? && (event.described_state == 'waiting_response' || event.described_state == 'internal_review')
+ elsif !curr_state.nil? && (event.event_type == 'followup_sent' || event.event_type == 'sent' || event.event_type == "status_update")
# Followups can set the status to waiting response / internal
# review. Initial requests ('sent') set the status to waiting response.
diff --git a/app/views/public_body/_alphabet.html.erb b/app/views/public_body/_alphabet.html.erb
index 111da5b3b..63b24e0fb 100644
--- a/app/views/public_body/_alphabet.html.erb
+++ b/app/views/public_body/_alphabet.html.erb
@@ -1,3 +1,3 @@
-<%= "A".upto("Z") do |l| -%>
+<%- "A".upto("Z") do |l| -%>
<%= link_to_unless (@tag == l), l, list_public_bodies_path(:tag => l.downcase) %>
<% end %>
diff --git a/app/views/public_body/_body_listing_single.html.erb b/app/views/public_body/_body_listing_single.html.erb
index 8e0a64df7..91a07d09c 100644
--- a/app/views/public_body/_body_listing_single.html.erb
+++ b/app/views/public_body/_body_listing_single.html.erb
@@ -20,8 +20,14 @@
<span class="bottomline">
<%= n_('{{count}} request made.', '{{count}} requests made.', public_body.info_requests.size,
:count => public_body.info_requests.size) %>
- <% if !@include_request_link_in_authority_listing.nil? %>
- <%= link_to _("Make your own request"), public_body_path(public_body) %>.
+ <% if !public_body.is_requestable? && public_body.not_requestable_reason != 'bad_contact' %>
+ <% if public_body.not_requestable_reason == 'defunct' %>
+ <%= _('Defunct.') %>
+ <% end %>
+ <% else %>
+ <% if !@include_request_link_in_authority_listing.nil? %>
+ <%= link_to _("Make your own request"), public_body_path(public_body) %>.
+ <% end %>
<% end %>
<br>
<span class="date_added">
diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb
index 47075a1f5..b35e29eea 100644
--- a/app/views/public_body/show.html.erb
+++ b/app/views/public_body/show.html.erb
@@ -46,12 +46,22 @@
<% end %>
</p>
- <% if @public_body.has_notes? && (@public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact') %>
- <p><%= @public_body.notes_as_html.html_safe %></p>
- <% end %>
-
- <% if @public_body.eir_only? %>
- <p><%= _('You can only request information about the environment from this authority.')%></p>
+ <% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
+ <% if @public_body.has_notes? %>
+ <p><%= @public_body.notes_as_html.html_safe %></p>
+ <% end %>
+ <% if @public_body.eir_only? %>
+ <p><%= _('You can only request information about the environment from this authority.')%></p>
+ <% end %>
+ <% else %>
+ <% if @public_body.not_requestable_reason == 'not_apply' %>
+ <p><%= _('Freedom of Information law does not apply to this authority, so you cannot make
+ a request to it.')%></p>
+ <% elsif @public_body.not_requestable_reason == 'defunct' %>
+ <p><%= _('This authority no longer exists, so you cannot make a request to it.')%></p>
+ <% else %>
+ <p><%= _('For an unknown reason, it is not possible to make a request to this authority.')%></p>
+ <% end %>
<% end %>
<div id="stepwise_make_request">
@@ -59,13 +69,6 @@
<%= link_to _("Make a request to this authority"), new_request_to_body_path(:url_name => @public_body.url_name), :class => "link_button_green" %>
<% elsif @public_body.has_notes? %>
<%= @public_body.notes_as_html.html_safe %>
- <% elsif @public_body.not_requestable_reason == 'not_apply' %>
- <%= _('Freedom of Information law does not apply to this authority, so you cannot make
- a request to it.')%>
- <% elsif @public_body.not_requestable_reason == 'defunct' %>
- <%= _('This authority no longer exists, so you cannot make a request to it.')%>
- <% else %>
- <%= _('For an unknown reason, it is not possible to make a request to this authority.')%>
<% end %>
<% if @public_body.override_request_email %>
@@ -78,12 +81,14 @@
<div id="foi_results_section">
<% if @public_body.info_requests.size == 0 %>
- <% if @public_body.eir_only? %>
- <h2><%= _('Environmental Information Regulations requests made using this site') %></h2>
- <p>Nobody has made any Environmental Information Regulations requests to <%=h(@public_body.name)%> using this site yet.</p>
- <% else %>
- <h2><%= _('Freedom of Information requests made using this site')%></h2>
- <p><%= _('Nobody has made any Freedom of Information requests to {{public_body_name}} using this site yet.', :public_body_name => h(@public_body.name))%></p>
+ <% if @public_body.is_requestable? or @public_body.not_requestable_reason != 'defunct' %>
+ <% if @public_body.eir_only? %>
+ <h2><%= _('Environmental Information Regulations requests made using this site') %></h2>
+ <p>Nobody has made any Environmental Information Regulations requests to <%=h(@public_body.name)%> using this site yet.</p>
+ <% else %>
+ <h2><%= _('Freedom of Information requests made using this site')%></h2>
+ <p><%= _('Nobody has made any Freedom of Information requests to {{public_body_name}} using this site yet.', :public_body_name => h(@public_body.name))%></p>
+ <% end %>
<% end %>
<% else %>
<h2 class="foi_results">
diff --git a/app/views/request/_sidebar.html.erb b/app/views/request/_sidebar.html.erb
index aba5c2fb3..e08f43eaa 100644
--- a/app/views/request/_sidebar.html.erb
+++ b/app/views/request/_sidebar.html.erb
@@ -58,7 +58,7 @@
<%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
<% end %>
<% if @xapian_similar_more %>
- <p><%= link_to _("More similar requests"), similar_request_path(@info_request) %></p>
+ <p><%= link_to _("More similar requests"), similar_request_path(@info_request.url_title) %></p>
<% end %>
<!-- Important terms: <%= @xapian_similar.important_terms.join(" ") %> -->
<% end %>
diff --git a/app/views/request/similar.html.erb b/app/views/request/similar.html.erb
index 0d53f6919..eb7ff636d 100644
--- a/app/views/request/similar.html.erb
+++ b/app/views/request/similar.html.erb
@@ -1,5 +1,16 @@
-<% @title = "Requests similar to '" + h(@info_request.title) + "'" + @page_desc %>
-<h1><%="Requests similar to '" + request_link(@info_request) + "'" + @page_desc %></h1>
+<%- if @page > 1 %>
+ <%- @title = _("Requests similar to '{{request_title}}' (page {{page}})", {:page => @page, :request_title => @info_request.title}) %>
+<%- else %>
+<%- @title = _("Requests similar to '{{request_title}}'", {:request_title => @info_request.title}) %>
+<%- end %>
+
+<h1>
+ <%- if @page > 1 %>
+ <%= _("Requests similar to '{{request_title}}' (page {{page}})", {:page => @page, :request_title => request_link(@info_request)}) %>
+ <%- else %>
+ <%= _("Requests similar to '{{request_title}}'", {:request_title => request_link(@info_request)}) %>
+ <%- end %>
+</h1>
<!-- Important terms: <%= @xapian_object.important_terms.join(" ") %> -->