diff options
86 files changed, 1148 insertions, 2490 deletions
diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..2aaf2528c --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-1.9.3-p392 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 339f08013..000000000 --- a/.rvmrc +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -# This is an RVM Project .rvmrc file, used to automatically load the ruby -# development environment upon cd'ing into the directory - -# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional, -# Only full ruby name is supported here, for short names use: -# echo "rvm use 1.9.3" > .rvmrc -environment_id="1.9.3-p392" - -# Uncomment the following lines if you want to verify rvm version per project -# rvmrc_rvm_version="1.14.10 (stable)" # 1.10.1 seams as a safe start -# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || { -# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading." -# return 1 -# } - -# First we attempt to load the desired environment directly from the environment -# file. This is very fast and efficient compared to running through the entire -# CLI and selector. If you want feedback on which environment was used then -# insert the word 'use' after --create as this triggers verbose mode. -if [[ -d "${rvm_path:-$HOME/.rvm}/environments" - && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] -then - \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" - [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] && - \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true - if [[ $- == *i* ]] # check for interactive shells - then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green - fi -else - # If the environment file has not yet been created, use the RVM CLI to select. - rvm --create use "$environment_id" || { - echo "Failed to create RVM environment '${environment_id}'." - return 1 - } -fi - -# If you use bundler, this might be useful to you: -# if [[ -s Gemfile ]] && { -# ! builtin command -v bundle >/dev/null || -# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null -# } -# then -# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n" -# gem install bundler -# fi -# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null -# then -# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete' -# fi @@ -46,6 +46,8 @@ gem 'gettext_i18n_rails' gem 'gettext' gem 'locale' gem 'routing-filter' +gem 'unicode' +gem 'unidecode' group :test do gem 'fakeweb' diff --git a/Gemfile.lock b/Gemfile.lock index 24e4dd5e3..fb83dadd7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -226,6 +226,8 @@ GEM polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) + unicode (0.4.4) + unidecode (1.0.0) vpim (0.695) webrat (0.7.3) nokogiri (>= 1.2.0) @@ -277,6 +279,8 @@ DEPENDENCIES ruby-msg (~> 1.5.0) spork-rails syslog_protocol + unicode + unidecode vpim webrat will_paginate diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 66989ea93..40ccfb98c 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -62,9 +62,6 @@ class AdminRequestController < AdminController @info_request.title = params[:info_request][:title] @info_request.prominence = params[:info_request][:prominence] - if @info_request.described_state != params[:info_request][:described_state] - @info_request.set_described_state(params[:info_request][:described_state]) - end @info_request.awaiting_description = params[:info_request][:awaiting_description] == "true" ? true : false @info_request.allow_new_responses_from = params[:info_request][:allow_new_responses_from] @info_request.handle_rejected_responses = params[:info_request][:handle_rejected_responses] @@ -77,13 +74,16 @@ class AdminRequestController < AdminController { :editor => admin_current_user(), :old_title => old_title, :title => @info_request.title, :old_prominence => old_prominence, :prominence => @info_request.prominence, - :old_described_state => old_described_state, :described_state => @info_request.described_state, + :old_described_state => old_described_state, :described_state => params[:info_request][:described_state], :old_awaiting_description => old_awaiting_description, :awaiting_description => @info_request.awaiting_description, :old_allow_new_responses_from => old_allow_new_responses_from, :allow_new_responses_from => @info_request.allow_new_responses_from, :old_handle_rejected_responses => old_handle_rejected_responses, :handle_rejected_responses => @info_request.handle_rejected_responses, :old_tag_string => old_tag_string, :tag_string => @info_request.tag_string, :old_comments_allowed => old_comments_allowed, :comments_allowed => @info_request.comments_allowed }) + if @info_request.described_state != params[:info_request][:described_state] + @info_request.set_described_state(params[:info_request][:described_state]) + end # expire cached files expire_for_request(@info_request) flash[:notice] = 'Request successfully updated.' diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 49b226e4b..e7bea67ef 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -63,6 +63,8 @@ class ApiController < ApplicationController :smtp_message_id => nil ) + request.set_described_state('waiting_response') + # Return the URL and ID number. render :json => { 'url' => make_url("request", request.url_title), diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 939dd1739..540f67ec9 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -147,7 +147,6 @@ class GeneralController < ApplicationController @query, _ = make_query_from_params(params) end @inputted_sortby = @sortby - @common_query = get_tags_from_params(params) if @sortby.nil? # Parse query, so can work out if it has prefix terms only - if so then it is a # structured query which should show newest first, rather than a free text search diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 42693f867..45d8b7de6 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))) @@ -589,7 +593,7 @@ class RequestController < ApplicationController @outgoing_message.set_signature_name(@user.name) if !@user.nil? if (not @incoming_message.nil?) and @info_request != @incoming_message.info_request - raise sprintf("Incoming message %d does not belong to request %d", @incoming_message.info_request_id, @info_request.id) + raise ActiveRecord::RecordNotFound.new("Incoming message #{@incoming_message.id} does not belong to request #{@info_request.id}") end # Test for hidden requests diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 1bf5a5316..175425280 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -19,8 +19,8 @@ class UserController < ApplicationController # Show page about a user def show long_cache - if MySociety::Format.simplify_url_part(params[:url_name], 'user', 32) != params[:url_name] - redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'user', 32), :status => :moved_permanently + if MySociety::Format.simplify_url_part(params[:url_name], 'user') != params[:url_name] + redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'user'), :status => :moved_permanently return end if params[:view].nil? 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..9bce2ca88 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -563,12 +563,15 @@ public end # change status, including for last event for later historical purposes + # described_state should always indicate the current state of the request, as described + # by the request owner (or, in some other cases an admin or other user) def set_described_state(new_state, set_by = nil, message = "") old_described_state = described_state ActiveRecord::Base.transaction do self.awaiting_description = false last_event = self.info_request_events.last last_event.described_state = new_state + self.described_state = new_state last_event.save! self.save! @@ -584,25 +587,18 @@ 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 - # Work out what the situation of the request is. In addition to values of - # self.described_state, can take these two values: + # Work out what state to display for the request on the site. In addition to values of + # self.described_state, can take these values: # waiting_classification # waiting_response_overdue # waiting_response_very_overdue + # (this method adds an assessment of overdueness with respect to the current time to 'waiting_response' + # states, and will return 'waiting_classification' instead of the described_state if the + # awaiting_description flag is set on the request). def calculate_status(cached_value_ok=false) if cached_value_ok && @cached_calculated_status return @cached_calculated_status @@ -621,10 +617,22 @@ public return 'waiting_response' end + + # 'described_state' can be populated on any info_request_event but is only + # ever used in the process populating calculated_state on the + # info_request_event (if it represents a response, outgoing message, edit + # or status update), or previous response or outgoing message events for + # the same request. + # Fill in any missing event states for first response before a description # was made. i.e. We take the last described state in between two responses # (inclusive of earlier), and set it as calculated value for the earlier - # response. + # response. Also set the calculated state for any initial outgoing message, + # follow up, edit or status_update to the described state of that event. + + # Note that the calculated state of the latest info_request_event will + # be used in latest_status based searches and should match the described_state + # of the info_request. def calculate_event_states curr_state = nil for event in self.info_request_events.reverse @@ -658,10 +666,22 @@ public event.save! end - # And we don't want to propogate it to the response itself, + # And we don't want to propagate it to the response itself, # as that might already be set to waiting_clarification / a # success status, which we want to know about. curr_state = nil + elsif !curr_state.nil? && (['edit', 'status_update'].include? event.event_type) + # A status update or edit event should get the same calculated state as described state + # so that the described state is always indexed (and will be the latest_status + # for the request immediately after it has been described, regardless of what + # other request events precede it). This means that request should be correctly included + # in status searches for that status. These events allow the described state to propagate in + # case there is a preceding response that the described state should be applied to. + if event.calculated_state != event.described_state + event.calculated_state = event.described_state + event.last_described_at = Time.now() + event.save! + end end end end @@ -1117,10 +1137,10 @@ public begin if self.described_state.nil? self.described_state = 'waiting_response' - end + end rescue ActiveModel::MissingAttributeError # this should only happen on Model.exists?() call. It can be safely ignored. - # See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/ + # See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/ end # FOI or EIR? if !self.public_body.nil? && self.public_body.eir_only? diff --git a/app/views/admin_general/timeline.html.erb b/app/views/admin_general/timeline.html.erb index 8fd8875b6..439ae1e68 100644 --- a/app/views/admin_general/timeline.html.erb +++ b/app/views/admin_general/timeline.html.erb @@ -88,7 +88,7 @@ <% elsif event.event_type == 'comment' %> had an annotation posted by <%=h event.comment.user.name %>. <% elsif event.event_type == 'status_update' %> - had its status updated by <%=h User.find(event.params[:user_id]).name %> from '<%= h event.params[:old_described_state] %>' to '<%= h event.params[:described_state] %>'. + had its status updated by <%= event.params[:user_id] ? User.find(event.params[:user_id]).name : event.params[:script] %> from '<%= h event.params[:old_described_state] %>' to '<%= h event.params[:described_state] %>'. <% else %> had '<%=event.event_type%>' done to it, parameters <%=h event.params_yaml%>. <% end %> diff --git a/app/views/admin_public_body/import_csv.html.erb b/app/views/admin_public_body/import_csv.html.erb index afda5a468..18341ecf1 100644 --- a/app/views/admin_public_body/import_csv.html.erb +++ b/app/views/admin_public_body/import_csv.html.erb @@ -31,8 +31,8 @@ <p> <label for="tag_behaviour">What to do with existing tags?</label> <%= select_tag 'tag_behaviour', - "<option value='add' selected>Add new tags to existing ones</option> - <option value='replace'>Replace existing tags with new ones</option>" + raw("<option value='add' selected>Add new tags to existing ones</option> + <option value='replace'>Replace existing tags with new ones</option>") %> </p> diff --git a/app/views/general/_locale_switcher.html.erb b/app/views/general/_locale_switcher.html.erb index d0040bb0d..a318f61f3 100644 --- a/app/views/general/_locale_switcher.html.erb +++ b/app/views/general/_locale_switcher.html.erb @@ -2,7 +2,7 @@ <div id="user_locale_switcher"> <div class="btn-group"> <% for possible_locale in FastGettext.default_available_locales %> - <% if possible_locale == I18n.locale.to_s %> + <% if possible_locale == FastGettext.locale %> <a href="#" class="btn disabled"><%= locale_name(possible_locale) %></a> <% else %> <a href="<%= url_for params.merge(:locale => possible_locale) %>" class="btn"><%= locale_name(possible_locale) %></a> diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 688816fa9..472fa8ec1 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -52,7 +52,7 @@ 'width': 920, 'height': 400, 'type': 'iframe', - 'href': '/<%= I18n.locale %>/profile/sign_in?modal=1', + 'href': '/<%= FastGettext.locale %>/profile/sign_in?modal=1', 'onClosed': function() { // modal_signin_successful variable set by modal dialog box if (typeof modal_signin_successful != 'undefined' ) { 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/new.html.erb b/app/views/request/new.html.erb index 8b7d38ac0..f8b97ffe3 100644 --- a/app/views/request/new.html.erb +++ b/app/views/request/new.html.erb @@ -141,7 +141,7 @@ <% if !@info_request.tag_string.empty? %> <p class="form_note"> - <!-- <label class="form_label" for="info_request_tag_string">Tags:</label> + <!-- <label class="form_label" for="info_request_tag_string"><%= _("Tags (separated by a space):") %></label> <%= f.text_field :tag_string, :size => 50 %> --> <%= f.hidden_field(:tag_string) %> 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(" ") %> --> diff --git a/commonlib b/commonlib -Subproject 4030473685e388acc75c428ed36267acc62b571 +Subproject 9462a28fe12b25637d6e67d7140d444632e3ff7 diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index d78bc3925..2c6ee2fbc 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -10,7 +10,7 @@ load "debug_helpers.rb" load "util.rb" # Application version -ALAVETELI_VERSION = '0.12' +ALAVETELI_VERSION = '0.13' # Add new inflection rules using the following format # (all these examples are active by default): @@ -34,14 +34,6 @@ if AlaveteliConfiguration::force_ssl ActionMailer::Base.default_url_options[:protocol] = "https" end -# fallback locale and available locales -available_locales = AlaveteliConfiguration::available_locales.split(/ /) -default_locale = AlaveteliConfiguration::default_locale - -FastGettext.default_available_locales = available_locales -I18n.locale = default_locale -I18n.available_locales = available_locales.map {|locale_name| locale_name.to_sym} -I18n.default_locale = default_locale # Load monkey patches and other things from lib/ require 'ruby19.rb' @@ -57,6 +49,10 @@ require 'public_body_categories' require 'ability' require 'normalize_string' require 'alaveteli_file_types' +require 'alaveteli_localization' + +AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales, + AlaveteliConfiguration::default_locale) # Allow tests to be run under a non-superuser database account if required if Rails.env == 'test' and ActiveRecord::Base.configurations['test']['constraint_disabling'] == false diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index 752448a41..b00524993 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -1,6 +1,5 @@ -FastGettext.add_text_domain 'app', :path => File.join(Rails.root, 'locale'), :type => :po -FastGettext.default_text_domain = 'app' +AlaveteliLocalization.set_default_text_domain('app', File.join(Rails.root, 'locale')) I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) -RoutingFilter::Locale.include_default_locale = AlaveteliConfiguration::include_default_locale_in_urls +AlaveteliLocalization.set_default_locale_urls(AlaveteliConfiguration::include_default_locale_in_urls) diff --git a/db/development_structure.sql b/db/development_structure.sql deleted file mode 100644 index 47e33e373..000000000 --- a/db/development_structure.sql +++ /dev/null @@ -1,2095 +0,0 @@ --- --- PostgreSQL database dump --- - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SET check_function_bodies = false; -SET client_min_messages = warning; - --- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; - - -SET search_path = public, pg_catalog; - -SET default_tablespace = ''; - -SET default_with_oids = false; - --- --- Name: acts_as_xapian_jobs; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE acts_as_xapian_jobs ( - id integer NOT NULL, - model character varying(255) NOT NULL, - model_id integer NOT NULL, - action character varying(255) NOT NULL -); - - --- --- Name: acts_as_xapian_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE acts_as_xapian_jobs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: acts_as_xapian_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE acts_as_xapian_jobs_id_seq OWNED BY acts_as_xapian_jobs.id; - - --- --- Name: censor_rules; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE censor_rules ( - id integer NOT NULL, - info_request_id integer, - user_id integer, - public_body_id integer, - text text NOT NULL, - replacement text NOT NULL, - last_edit_editor character varying(255) NOT NULL, - last_edit_comment text NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - regexp boolean -); - - --- --- Name: censor_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE censor_rules_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: censor_rules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE censor_rules_id_seq OWNED BY censor_rules.id; - - --- --- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE comments ( - id integer NOT NULL, - user_id integer NOT NULL, - comment_type character varying(255) DEFAULT 'internal_error'::character varying NOT NULL, - info_request_id integer, - body text NOT NULL, - visible boolean DEFAULT true NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - locale text DEFAULT ''::text NOT NULL -); - - --- --- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE comments_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE comments_id_seq OWNED BY comments.id; - - --- --- Name: mail_server_log_dones; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE mail_server_log_dones ( - id integer NOT NULL, - filename text NOT NULL, - last_stat timestamp without time zone NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - - --- --- Name: exim_log_dones_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE exim_log_dones_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: exim_log_dones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE exim_log_dones_id_seq OWNED BY mail_server_log_dones.id; - - --- --- Name: mail_server_logs; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE mail_server_logs ( - id integer NOT NULL, - mail_server_log_done_id integer, - info_request_id integer, - "order" integer NOT NULL, - line text NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - - --- --- Name: exim_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE exim_logs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: exim_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE exim_logs_id_seq OWNED BY mail_server_logs.id; - - --- --- Name: foi_attachments; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE foi_attachments ( - id integer NOT NULL, - content_type text, - filename text, - charset text, - display_size text, - url_part_number integer, - within_rfc822_subject text, - incoming_message_id integer, - hexdigest character varying(32) -); - - --- --- Name: foi_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE foi_attachments_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: foi_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE foi_attachments_id_seq OWNED BY foi_attachments.id; - - --- --- Name: has_tag_string_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE has_tag_string_tags ( - id integer NOT NULL, - model_id integer NOT NULL, - name text NOT NULL, - created_at timestamp without time zone NOT NULL, - value text, - model character varying(255) NOT NULL -); - - --- --- Name: holidays; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE holidays ( - id integer NOT NULL, - day date, - description text -); - - --- --- Name: holidays_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE holidays_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: holidays_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE holidays_id_seq OWNED BY holidays.id; - - --- --- Name: incoming_messages; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE incoming_messages ( - id integer NOT NULL, - info_request_id integer NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - raw_email_id integer NOT NULL, - cached_attachment_text_clipped text, - cached_main_body_text_folded text, - cached_main_body_text_unfolded text, - subject text, - mail_from_domain text, - valid_to_reply_to boolean, - last_parsed timestamp without time zone, - mail_from text, - sent_at timestamp without time zone -); - - --- --- Name: incoming_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE incoming_messages_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: incoming_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE incoming_messages_id_seq OWNED BY incoming_messages.id; - - --- --- Name: info_request_events; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE info_request_events ( - id integer NOT NULL, - info_request_id integer NOT NULL, - event_type text NOT NULL, - params_yaml text NOT NULL, - created_at timestamp without time zone NOT NULL, - described_state character varying(255), - calculated_state character varying(255) DEFAULT NULL::character varying, - last_described_at timestamp without time zone, - incoming_message_id integer, - outgoing_message_id integer, - comment_id integer, - prominence character varying(255) DEFAULT 'normal'::character varying NOT NULL -); - - --- --- Name: info_request_events_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE info_request_events_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: info_request_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE info_request_events_id_seq OWNED BY info_request_events.id; - - --- --- Name: info_requests; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE info_requests ( - id integer NOT NULL, - title text NOT NULL, - user_id integer, - public_body_id integer NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - described_state character varying(255) NOT NULL, - awaiting_description boolean DEFAULT false NOT NULL, - prominence character varying(255) DEFAULT 'normal'::character varying NOT NULL, - url_title text NOT NULL, - law_used character varying(255) DEFAULT 'foi'::character varying NOT NULL, - allow_new_responses_from character varying(255) DEFAULT 'anybody'::character varying NOT NULL, - handle_rejected_responses character varying(255) DEFAULT 'bounce'::character varying NOT NULL, - idhash character varying(255) NOT NULL, - external_user_name character varying(255), - external_url character varying(255), - attention_requested boolean DEFAULT false, - comments_allowed boolean DEFAULT true NOT NULL, - CONSTRAINT info_requests_external_ck CHECK ((((user_id IS NULL) = (external_url IS NOT NULL)) AND ((external_url IS NOT NULL) OR (external_user_name IS NULL)))) -); - - --- --- Name: info_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE info_requests_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: info_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE info_requests_id_seq OWNED BY info_requests.id; - - --- --- Name: outgoing_messages; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE outgoing_messages ( - id integer NOT NULL, - info_request_id integer NOT NULL, - body text NOT NULL, - status character varying(255) NOT NULL, - message_type character varying(255) NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - last_sent_at timestamp without time zone, - incoming_message_followup_id integer, - what_doing character varying(255) NOT NULL -); - - --- --- Name: outgoing_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE outgoing_messages_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: outgoing_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE outgoing_messages_id_seq OWNED BY outgoing_messages.id; - - --- --- Name: post_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE post_redirects ( - id integer NOT NULL, - token text NOT NULL, - uri text NOT NULL, - post_params_yaml text, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - email_token text NOT NULL, - reason_params_yaml text, - user_id integer, - circumstance text DEFAULT 'normal'::text NOT NULL -); - - --- --- Name: post_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE post_redirects_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: post_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE post_redirects_id_seq OWNED BY post_redirects.id; - - --- --- Name: profile_photos; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE profile_photos ( - id integer NOT NULL, - data bytea NOT NULL, - user_id integer, - draft boolean DEFAULT false NOT NULL -); - - --- --- Name: profile_photos_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE profile_photos_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: profile_photos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE profile_photos_id_seq OWNED BY profile_photos.id; - - --- --- Name: public_bodies; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE public_bodies ( - id integer NOT NULL, - name text NOT NULL, - short_name text NOT NULL, - request_email text NOT NULL, - version integer NOT NULL, - last_edit_editor character varying(255) NOT NULL, - last_edit_comment text NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - url_name text NOT NULL, - home_page text DEFAULT ''::text NOT NULL, - notes text DEFAULT ''::text NOT NULL, - first_letter character varying(255) NOT NULL, - publication_scheme text DEFAULT ''::text NOT NULL, - api_key character varying(255) NOT NULL, - info_requests_count integer DEFAULT 0 NOT NULL, - disclosure_log text DEFAULT ''::text NOT NULL -); - - --- --- Name: public_bodies_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public_bodies_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: public_bodies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public_bodies_id_seq OWNED BY public_bodies.id; - - --- --- Name: public_body_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public_body_tags_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: public_body_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public_body_tags_id_seq OWNED BY has_tag_string_tags.id; - - --- --- Name: public_body_translations; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE public_body_translations ( - id integer NOT NULL, - public_body_id integer, - locale character varying(255), - short_name text, - publication_scheme text, - url_name text, - first_letter character varying(255), - notes text, - name text, - request_email text, - created_at timestamp without time zone, - updated_at timestamp without time zone, - disclosure_log text -); - - --- --- Name: public_body_translations_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public_body_translations_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: public_body_translations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public_body_translations_id_seq OWNED BY public_body_translations.id; - - --- --- Name: public_body_versions; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE public_body_versions ( - id integer NOT NULL, - public_body_id integer, - version integer, - name text, - short_name text, - request_email text, - updated_at timestamp without time zone, - last_edit_editor character varying(255), - last_edit_comment text, - url_name text, - home_page text, - notes text, - publication_scheme text DEFAULT ''::text NOT NULL, - charity_number text DEFAULT ''::text NOT NULL, - disclosure_log text DEFAULT ''::text NOT NULL -); - - --- --- Name: public_body_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public_body_versions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: public_body_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public_body_versions_id_seq OWNED BY public_body_versions.id; - - --- --- Name: purge_requests; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE purge_requests ( - id integer NOT NULL, - url character varying(255), - created_at timestamp without time zone NOT NULL, - model character varying(255) NOT NULL, - model_id integer NOT NULL -); - - --- --- Name: purge_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE purge_requests_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: purge_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE purge_requests_id_seq OWNED BY purge_requests.id; - - --- --- Name: raw_emails; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE raw_emails ( - id integer NOT NULL -); - - --- --- Name: raw_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE raw_emails_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: raw_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE raw_emails_id_seq OWNED BY raw_emails.id; - - --- --- Name: request_classifications; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE request_classifications ( - id integer NOT NULL, - user_id integer, - info_request_event_id integer, - created_at timestamp without time zone, - updated_at timestamp without time zone -); - - --- --- Name: request_classifications_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE request_classifications_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: request_classifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE request_classifications_id_seq OWNED BY request_classifications.id; - - --- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE schema_migrations ( - version character varying(255) NOT NULL -); - - --- --- Name: track_things; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE track_things ( - id integer NOT NULL, - tracking_user_id integer NOT NULL, - track_query character varying(255) NOT NULL, - info_request_id integer, - tracked_user_id integer, - public_body_id integer, - track_medium character varying(255) NOT NULL, - track_type character varying(255) DEFAULT 'internal_error'::character varying NOT NULL, - created_at timestamp without time zone, - updated_at timestamp without time zone -); - - --- --- Name: track_things_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE track_things_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: track_things_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE track_things_id_seq OWNED BY track_things.id; - - --- --- Name: track_things_sent_emails; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE track_things_sent_emails ( - id integer NOT NULL, - track_thing_id integer NOT NULL, - info_request_event_id integer, - user_id integer, - public_body_id integer, - created_at timestamp without time zone, - updated_at timestamp without time zone -); - - --- --- Name: track_things_sent_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE track_things_sent_emails_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: track_things_sent_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE track_things_sent_emails_id_seq OWNED BY track_things_sent_emails.id; - - --- --- Name: user_info_request_sent_alerts; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE user_info_request_sent_alerts ( - id integer NOT NULL, - user_id integer NOT NULL, - info_request_id integer NOT NULL, - alert_type character varying(255) NOT NULL, - info_request_event_id integer -); - - --- --- Name: user_info_request_sent_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE user_info_request_sent_alerts_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: user_info_request_sent_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE user_info_request_sent_alerts_id_seq OWNED BY user_info_request_sent_alerts.id; - - --- --- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE users ( - id integer NOT NULL, - email character varying(255) NOT NULL, - name character varying(255) NOT NULL, - hashed_password character varying(255) NOT NULL, - salt character varying(255) NOT NULL, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - email_confirmed boolean DEFAULT false NOT NULL, - url_name text NOT NULL, - last_daily_track_email timestamp without time zone DEFAULT '2000-01-01 00:00:00'::timestamp without time zone, - admin_level character varying(255) DEFAULT 'none'::character varying NOT NULL, - ban_text text DEFAULT ''::text NOT NULL, - about_me text DEFAULT ''::text NOT NULL, - locale character varying(255), - email_bounced_at timestamp without time zone, - email_bounce_message text DEFAULT ''::text NOT NULL, - no_limit boolean DEFAULT false NOT NULL, - receive_email_alerts boolean DEFAULT true NOT NULL -); - - --- --- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE users_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE users_id_seq OWNED BY users.id; - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE acts_as_xapian_jobs ALTER COLUMN id SET DEFAULT nextval('acts_as_xapian_jobs_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE censor_rules ALTER COLUMN id SET DEFAULT nextval('censor_rules_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE foi_attachments ALTER COLUMN id SET DEFAULT nextval('foi_attachments_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE has_tag_string_tags ALTER COLUMN id SET DEFAULT nextval('public_body_tags_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE holidays ALTER COLUMN id SET DEFAULT nextval('holidays_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE incoming_messages ALTER COLUMN id SET DEFAULT nextval('incoming_messages_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE info_request_events ALTER COLUMN id SET DEFAULT nextval('info_request_events_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE info_requests ALTER COLUMN id SET DEFAULT nextval('info_requests_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE mail_server_log_dones ALTER COLUMN id SET DEFAULT nextval('exim_log_dones_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE mail_server_logs ALTER COLUMN id SET DEFAULT nextval('exim_logs_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE outgoing_messages ALTER COLUMN id SET DEFAULT nextval('outgoing_messages_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE post_redirects ALTER COLUMN id SET DEFAULT nextval('post_redirects_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE profile_photos ALTER COLUMN id SET DEFAULT nextval('profile_photos_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE public_bodies ALTER COLUMN id SET DEFAULT nextval('public_bodies_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE public_body_translations ALTER COLUMN id SET DEFAULT nextval('public_body_translations_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE public_body_versions ALTER COLUMN id SET DEFAULT nextval('public_body_versions_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE purge_requests ALTER COLUMN id SET DEFAULT nextval('purge_requests_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE raw_emails ALTER COLUMN id SET DEFAULT nextval('raw_emails_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE request_classifications ALTER COLUMN id SET DEFAULT nextval('request_classifications_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE track_things ALTER COLUMN id SET DEFAULT nextval('track_things_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE track_things_sent_emails ALTER COLUMN id SET DEFAULT nextval('track_things_sent_emails_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE user_info_request_sent_alerts ALTER COLUMN id SET DEFAULT nextval('user_info_request_sent_alerts_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); - - --- --- Name: acts_as_xapian_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY acts_as_xapian_jobs - ADD CONSTRAINT acts_as_xapian_jobs_pkey PRIMARY KEY (id); - - --- --- Name: censor_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY censor_rules - ADD CONSTRAINT censor_rules_pkey PRIMARY KEY (id); - - --- --- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY comments - ADD CONSTRAINT comments_pkey PRIMARY KEY (id); - - --- --- Name: exim_log_dones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY mail_server_log_dones - ADD CONSTRAINT exim_log_dones_pkey PRIMARY KEY (id); - - --- --- Name: exim_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY mail_server_logs - ADD CONSTRAINT exim_logs_pkey PRIMARY KEY (id); - - --- --- Name: foi_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY foi_attachments - ADD CONSTRAINT foi_attachments_pkey PRIMARY KEY (id); - - --- --- Name: holidays_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY holidays - ADD CONSTRAINT holidays_pkey PRIMARY KEY (id); - - --- --- Name: incoming_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY incoming_messages - ADD CONSTRAINT incoming_messages_pkey PRIMARY KEY (id); - - --- --- Name: info_request_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY info_request_events - ADD CONSTRAINT info_request_events_pkey PRIMARY KEY (id); - - --- --- Name: info_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY info_requests - ADD CONSTRAINT info_requests_pkey PRIMARY KEY (id); - - --- --- Name: outgoing_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY outgoing_messages - ADD CONSTRAINT outgoing_messages_pkey PRIMARY KEY (id); - - --- --- Name: post_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY post_redirects - ADD CONSTRAINT post_redirects_pkey PRIMARY KEY (id); - - --- --- Name: profile_photos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY profile_photos - ADD CONSTRAINT profile_photos_pkey PRIMARY KEY (id); - - --- --- Name: public_bodies_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY public_bodies - ADD CONSTRAINT public_bodies_pkey PRIMARY KEY (id); - - --- --- Name: public_body_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY has_tag_string_tags - ADD CONSTRAINT public_body_tags_pkey PRIMARY KEY (id); - - --- --- Name: public_body_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY public_body_translations - ADD CONSTRAINT public_body_translations_pkey PRIMARY KEY (id); - - --- --- Name: public_body_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY public_body_versions - ADD CONSTRAINT public_body_versions_pkey PRIMARY KEY (id); - - --- --- Name: purge_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY purge_requests - ADD CONSTRAINT purge_requests_pkey PRIMARY KEY (id); - - --- --- Name: raw_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY raw_emails - ADD CONSTRAINT raw_emails_pkey PRIMARY KEY (id); - - --- --- Name: request_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY request_classifications - ADD CONSTRAINT request_classifications_pkey PRIMARY KEY (id); - - --- --- Name: track_things_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY track_things - ADD CONSTRAINT track_things_pkey PRIMARY KEY (id); - - --- --- Name: track_things_sent_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY track_things_sent_emails - ADD CONSTRAINT track_things_sent_emails_pkey PRIMARY KEY (id); - - --- --- Name: user_info_request_sent_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY user_info_request_sent_alerts - ADD CONSTRAINT user_info_request_sent_alerts_pkey PRIMARY KEY (id); - - --- --- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: by_model_and_model_id_and_name_and_value; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX by_model_and_model_id_and_name_and_value ON has_tag_string_tags USING btree (model, model_id, name, value); - - --- --- Name: index_acts_as_xapian_jobs_on_model_and_model_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX index_acts_as_xapian_jobs_on_model_and_model_id ON acts_as_xapian_jobs USING btree (model, model_id); - - --- --- Name: index_censor_rules_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_censor_rules_on_info_request_id ON censor_rules USING btree (info_request_id); - - --- --- Name: index_censor_rules_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_censor_rules_on_public_body_id ON censor_rules USING btree (public_body_id); - - --- --- Name: index_censor_rules_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_censor_rules_on_user_id ON censor_rules USING btree (user_id); - - --- --- Name: index_exim_log_dones_on_last_stat; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_exim_log_dones_on_last_stat ON mail_server_log_dones USING btree (last_stat); - - --- --- Name: index_exim_logs_on_exim_log_done_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_exim_logs_on_exim_log_done_id ON mail_server_logs USING btree (mail_server_log_done_id); - - --- --- Name: index_exim_logs_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_exim_logs_on_info_request_id ON mail_server_logs USING btree (info_request_id); - - --- --- Name: index_foi_attachments_on_incoming_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_foi_attachments_on_incoming_message_id ON foi_attachments USING btree (incoming_message_id); - - --- --- Name: index_has_tag_string_tags_on_model_and_model_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_has_tag_string_tags_on_model_and_model_id ON has_tag_string_tags USING btree (model, model_id); - - --- --- Name: index_has_tag_string_tags_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_has_tag_string_tags_on_name ON has_tag_string_tags USING btree (name); - - --- --- Name: index_holidays_on_day; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_holidays_on_day ON holidays USING btree (day); - - --- --- Name: index_incoming_messages_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_incoming_messages_on_info_request_id ON incoming_messages USING btree (info_request_id); - - --- --- Name: index_incoming_messages_on_raw_email_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_incoming_messages_on_raw_email_id ON incoming_messages USING btree (raw_email_id); - - --- --- Name: index_info_request_events_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_request_events_on_comment_id ON info_request_events USING btree (comment_id); - - --- --- Name: index_info_request_events_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_request_events_on_created_at ON info_request_events USING btree (created_at); - - --- --- Name: index_info_request_events_on_incoming_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_request_events_on_incoming_message_id ON info_request_events USING btree (incoming_message_id); - - --- --- Name: index_info_request_events_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_request_events_on_info_request_id ON info_request_events USING btree (info_request_id); - - --- --- Name: index_info_request_events_on_outgoing_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_request_events_on_outgoing_message_id ON info_request_events USING btree (outgoing_message_id); - - --- --- Name: index_info_requests_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_requests_on_created_at ON info_requests USING btree (created_at); - - --- --- Name: index_info_requests_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_requests_on_public_body_id ON info_requests USING btree (public_body_id); - - --- --- Name: index_info_requests_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_requests_on_title ON info_requests USING btree (title); - - --- --- Name: index_info_requests_on_url_title; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX index_info_requests_on_url_title ON info_requests USING btree (url_title); - - --- --- Name: index_info_requests_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_info_requests_on_user_id ON info_requests USING btree (user_id); - - --- --- Name: index_outgoing_messages_on_incoming_message_followup_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_outgoing_messages_on_incoming_message_followup_id ON outgoing_messages USING btree (incoming_message_followup_id); - - --- --- Name: index_outgoing_messages_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_outgoing_messages_on_info_request_id ON outgoing_messages USING btree (info_request_id); - - --- --- Name: index_outgoing_messages_on_what_doing; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_outgoing_messages_on_what_doing ON outgoing_messages USING btree (what_doing); - - --- --- Name: index_post_redirects_on_email_token; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_post_redirects_on_email_token ON post_redirects USING btree (email_token); - - --- --- Name: index_post_redirects_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_post_redirects_on_token ON post_redirects USING btree (token); - - --- --- Name: index_post_redirects_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_post_redirects_on_updated_at ON post_redirects USING btree (updated_at); - - --- --- Name: index_post_redirects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_post_redirects_on_user_id ON post_redirects USING btree (user_id); - - --- --- Name: index_public_bodies_on_first_letter; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_public_bodies_on_first_letter ON public_bodies USING btree (first_letter); - - --- --- Name: index_public_bodies_on_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX index_public_bodies_on_url_name ON public_bodies USING btree (url_name); - - --- --- Name: index_public_body_translations_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_public_body_translations_on_public_body_id ON public_body_translations USING btree (public_body_id); - - --- --- Name: index_public_body_versions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_public_body_versions_on_updated_at ON public_body_versions USING btree (updated_at); - - --- --- Name: index_request_classifications_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_request_classifications_on_user_id ON request_classifications USING btree (user_id); - - --- --- Name: index_track_things_on_tracking_user_id_and_track_query; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX index_track_things_on_tracking_user_id_and_track_query ON track_things USING btree (tracking_user_id, track_query); - - --- --- Name: index_track_things_sent_emails_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_track_things_sent_emails_on_created_at ON track_things_sent_emails USING btree (created_at); - - --- --- Name: index_track_things_sent_emails_on_info_request_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_track_things_sent_emails_on_info_request_event_id ON track_things_sent_emails USING btree (info_request_event_id); - - --- --- Name: index_track_things_sent_emails_on_track_thing_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_track_things_sent_emails_on_track_thing_id ON track_things_sent_emails USING btree (track_thing_id); - - --- --- Name: index_user_info_request_sent_alerts_on_info_request_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX index_user_info_request_sent_alerts_on_info_request_event_id ON user_info_request_sent_alerts USING btree (info_request_event_id); - - --- --- Name: index_users_on_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX index_users_on_url_name ON users USING btree (url_name); - - --- --- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version); - - --- --- Name: user_info_request_sent_alerts_unique_index; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX user_info_request_sent_alerts_unique_index ON user_info_request_sent_alerts USING btree (user_id, info_request_id, alert_type, (COALESCE(info_request_event_id, (-1)))); - - --- --- Name: users_email_index; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX users_email_index ON users USING btree (lower((email)::text)); - - --- --- Name: users_lower_email_index; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE INDEX users_lower_email_index ON users USING btree (lower((email)::text)); - - --- --- Name: fk_censor_rules_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY censor_rules - ADD CONSTRAINT fk_censor_rules_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_censor_rules_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY censor_rules - ADD CONSTRAINT fk_censor_rules_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); - - --- --- Name: fk_censor_rules_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY censor_rules - ADD CONSTRAINT fk_censor_rules_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_comments_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY comments - ADD CONSTRAINT fk_comments_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_comments_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY comments - ADD CONSTRAINT fk_comments_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_exim_log_done; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY mail_server_logs - ADD CONSTRAINT fk_exim_log_done FOREIGN KEY (mail_server_log_done_id) REFERENCES mail_server_log_dones(id); - - --- --- Name: fk_exim_log_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY mail_server_logs - ADD CONSTRAINT fk_exim_log_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_incoming_message_followup_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY outgoing_messages - ADD CONSTRAINT fk_incoming_message_followup_info_request FOREIGN KEY (incoming_message_followup_id) REFERENCES incoming_messages(id); - - --- --- Name: fk_incoming_messages_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY incoming_messages - ADD CONSTRAINT fk_incoming_messages_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_incoming_messages_raw_email; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY incoming_messages - ADD CONSTRAINT fk_incoming_messages_raw_email FOREIGN KEY (raw_email_id) REFERENCES raw_emails(id); - - --- --- Name: fk_info_request_events_comment_id; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY info_request_events - ADD CONSTRAINT fk_info_request_events_comment_id FOREIGN KEY (comment_id) REFERENCES comments(id); - - --- --- Name: fk_info_request_events_incoming_message_id; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY info_request_events - ADD CONSTRAINT fk_info_request_events_incoming_message_id FOREIGN KEY (incoming_message_id) REFERENCES incoming_messages(id); - - --- --- Name: fk_info_request_events_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY info_request_events - ADD CONSTRAINT fk_info_request_events_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_info_request_events_outgoing_message_id; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY info_request_events - ADD CONSTRAINT fk_info_request_events_outgoing_message_id FOREIGN KEY (outgoing_message_id) REFERENCES outgoing_messages(id); - - --- --- Name: fk_info_request_sent_alerts_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY user_info_request_sent_alerts - ADD CONSTRAINT fk_info_request_sent_alerts_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_info_request_sent_alerts_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY user_info_request_sent_alerts - ADD CONSTRAINT fk_info_request_sent_alerts_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_info_requests_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY info_requests - ADD CONSTRAINT fk_info_requests_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); - - --- --- Name: fk_info_requests_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY info_requests - ADD CONSTRAINT fk_info_requests_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_outgoing_messages_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY outgoing_messages - ADD CONSTRAINT fk_outgoing_messages_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_post_redirects_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY post_redirects - ADD CONSTRAINT fk_post_redirects_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_profile_photos_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY profile_photos - ADD CONSTRAINT fk_profile_photos_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_public_body_versions_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public_body_versions - ADD CONSTRAINT fk_public_body_versions_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); - - --- --- Name: fk_track_request_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things - ADD CONSTRAINT fk_track_request_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); - - --- --- Name: fk_track_request_info_request_event; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things_sent_emails - ADD CONSTRAINT fk_track_request_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id); - - --- --- Name: fk_track_request_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things - ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); - - --- --- Name: fk_track_request_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things_sent_emails - ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_track_request_tracked_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things - ADD CONSTRAINT fk_track_request_tracked_user FOREIGN KEY (tracked_user_id) REFERENCES users(id); - - --- --- Name: fk_track_request_tracking_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things - ADD CONSTRAINT fk_track_request_tracking_user FOREIGN KEY (tracking_user_id) REFERENCES users(id); - - --- --- Name: fk_track_request_user; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY track_things_sent_emails - ADD CONSTRAINT fk_track_request_user FOREIGN KEY (user_id) REFERENCES users(id); - - --- --- Name: fk_user_info_request_sent_alert_info_request_event; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY user_info_request_sent_alerts - ADD CONSTRAINT fk_user_info_request_sent_alert_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id); - - --- --- PostgreSQL database dump complete --- - -INSERT INTO schema_migrations (version) VALUES ('1'); - -INSERT INTO schema_migrations (version) VALUES ('2'); - -INSERT INTO schema_migrations (version) VALUES ('4'); - -INSERT INTO schema_migrations (version) VALUES ('5'); - -INSERT INTO schema_migrations (version) VALUES ('6'); - -INSERT INTO schema_migrations (version) VALUES ('7'); - -INSERT INTO schema_migrations (version) VALUES ('8'); - -INSERT INTO schema_migrations (version) VALUES ('9'); - -INSERT INTO schema_migrations (version) VALUES ('10'); - -INSERT INTO schema_migrations (version) VALUES ('11'); - -INSERT INTO schema_migrations (version) VALUES ('12'); - -INSERT INTO schema_migrations (version) VALUES ('13'); - -INSERT INTO schema_migrations (version) VALUES ('14'); - -INSERT INTO schema_migrations (version) VALUES ('15'); - -INSERT INTO schema_migrations (version) VALUES ('16'); - -INSERT INTO schema_migrations (version) VALUES ('17'); - -INSERT INTO schema_migrations (version) VALUES ('18'); - -INSERT INTO schema_migrations (version) VALUES ('21'); - -INSERT INTO schema_migrations (version) VALUES ('22'); - -INSERT INTO schema_migrations (version) VALUES ('23'); - -INSERT INTO schema_migrations (version) VALUES ('24'); - -INSERT INTO schema_migrations (version) VALUES ('25'); - -INSERT INTO schema_migrations (version) VALUES ('26'); - -INSERT INTO schema_migrations (version) VALUES ('27'); - -INSERT INTO schema_migrations (version) VALUES ('28'); - -INSERT INTO schema_migrations (version) VALUES ('29'); - -INSERT INTO schema_migrations (version) VALUES ('30'); - -INSERT INTO schema_migrations (version) VALUES ('31'); - -INSERT INTO schema_migrations (version) VALUES ('32'); - -INSERT INTO schema_migrations (version) VALUES ('33'); - -INSERT INTO schema_migrations (version) VALUES ('34'); - -INSERT INTO schema_migrations (version) VALUES ('35'); - -INSERT INTO schema_migrations (version) VALUES ('36'); - -INSERT INTO schema_migrations (version) VALUES ('37'); - -INSERT INTO schema_migrations (version) VALUES ('38'); - -INSERT INTO schema_migrations (version) VALUES ('39'); - -INSERT INTO schema_migrations (version) VALUES ('40'); - -INSERT INTO schema_migrations (version) VALUES ('41'); - -INSERT INTO schema_migrations (version) VALUES ('42'); - -INSERT INTO schema_migrations (version) VALUES ('43'); - -INSERT INTO schema_migrations (version) VALUES ('44'); - -INSERT INTO schema_migrations (version) VALUES ('45'); - -INSERT INTO schema_migrations (version) VALUES ('46'); - -INSERT INTO schema_migrations (version) VALUES ('47'); - -INSERT INTO schema_migrations (version) VALUES ('48'); - -INSERT INTO schema_migrations (version) VALUES ('49'); - -INSERT INTO schema_migrations (version) VALUES ('50'); - -INSERT INTO schema_migrations (version) VALUES ('51'); - -INSERT INTO schema_migrations (version) VALUES ('52'); - -INSERT INTO schema_migrations (version) VALUES ('53'); - -INSERT INTO schema_migrations (version) VALUES ('54'); - -INSERT INTO schema_migrations (version) VALUES ('55'); - -INSERT INTO schema_migrations (version) VALUES ('56'); - -INSERT INTO schema_migrations (version) VALUES ('57'); - -INSERT INTO schema_migrations (version) VALUES ('58'); - -INSERT INTO schema_migrations (version) VALUES ('59'); - -INSERT INTO schema_migrations (version) VALUES ('60'); - -INSERT INTO schema_migrations (version) VALUES ('61'); - -INSERT INTO schema_migrations (version) VALUES ('62'); - -INSERT INTO schema_migrations (version) VALUES ('63'); - -INSERT INTO schema_migrations (version) VALUES ('64'); - -INSERT INTO schema_migrations (version) VALUES ('65'); - -INSERT INTO schema_migrations (version) VALUES ('66'); - -INSERT INTO schema_migrations (version) VALUES ('67'); - -INSERT INTO schema_migrations (version) VALUES ('68'); - -INSERT INTO schema_migrations (version) VALUES ('69'); - -INSERT INTO schema_migrations (version) VALUES ('70'); - -INSERT INTO schema_migrations (version) VALUES ('71'); - -INSERT INTO schema_migrations (version) VALUES ('72'); - -INSERT INTO schema_migrations (version) VALUES ('73'); - -INSERT INTO schema_migrations (version) VALUES ('74'); - -INSERT INTO schema_migrations (version) VALUES ('75'); - -INSERT INTO schema_migrations (version) VALUES ('76'); - -INSERT INTO schema_migrations (version) VALUES ('77'); - -INSERT INTO schema_migrations (version) VALUES ('78'); - -INSERT INTO schema_migrations (version) VALUES ('79'); - -INSERT INTO schema_migrations (version) VALUES ('80'); - -INSERT INTO schema_migrations (version) VALUES ('81'); - -INSERT INTO schema_migrations (version) VALUES ('82'); - -INSERT INTO schema_migrations (version) VALUES ('83'); - -INSERT INTO schema_migrations (version) VALUES ('84'); - -INSERT INTO schema_migrations (version) VALUES ('85'); - -INSERT INTO schema_migrations (version) VALUES ('86'); - -INSERT INTO schema_migrations (version) VALUES ('87'); - -INSERT INTO schema_migrations (version) VALUES ('88'); - -INSERT INTO schema_migrations (version) VALUES ('89'); - -INSERT INTO schema_migrations (version) VALUES ('90'); - -INSERT INTO schema_migrations (version) VALUES ('91'); - -INSERT INTO schema_migrations (version) VALUES ('92'); - -INSERT INTO schema_migrations (version) VALUES ('93'); - -INSERT INTO schema_migrations (version) VALUES ('94'); - -INSERT INTO schema_migrations (version) VALUES ('95'); - -INSERT INTO schema_migrations (version) VALUES ('96'); - -INSERT INTO schema_migrations (version) VALUES ('97'); - -INSERT INTO schema_migrations (version) VALUES ('98'); - -INSERT INTO schema_migrations (version) VALUES ('99'); - -INSERT INTO schema_migrations (version) VALUES ('100'); - -INSERT INTO schema_migrations (version) VALUES ('101'); - -INSERT INTO schema_migrations (version) VALUES ('102'); - -INSERT INTO schema_migrations (version) VALUES ('103'); - -INSERT INTO schema_migrations (version) VALUES ('104'); - -INSERT INTO schema_migrations (version) VALUES ('105'); - -INSERT INTO schema_migrations (version) VALUES ('106'); - -INSERT INTO schema_migrations (version) VALUES ('107'); - -INSERT INTO schema_migrations (version) VALUES ('108'); - -INSERT INTO schema_migrations (version) VALUES ('109'); - -INSERT INTO schema_migrations (version) VALUES ('110'); - -INSERT INTO schema_migrations (version) VALUES ('111'); - -INSERT INTO schema_migrations (version) VALUES ('112'); - -INSERT INTO schema_migrations (version) VALUES ('113'); - -INSERT INTO schema_migrations (version) VALUES ('114'); - -INSERT INTO schema_migrations (version) VALUES ('115'); - -INSERT INTO schema_migrations (version) VALUES ('116'); - -INSERT INTO schema_migrations (version) VALUES ('117'); - -INSERT INTO schema_migrations (version) VALUES ('118'); - -INSERT INTO schema_migrations (version) VALUES ('20120822145640'); - -INSERT INTO schema_migrations (version) VALUES ('20120910153022'); - -INSERT INTO schema_migrations (version) VALUES ('20120912111713'); - -INSERT INTO schema_migrations (version) VALUES ('20120912112036'); - -INSERT INTO schema_migrations (version) VALUES ('20120912112312'); - -INSERT INTO schema_migrations (version) VALUES ('20120912112655'); - -INSERT INTO schema_migrations (version) VALUES ('20120912113004'); - -INSERT INTO schema_migrations (version) VALUES ('20120912113720'); - -INSERT INTO schema_migrations (version) VALUES ('20120912114022'); - -INSERT INTO schema_migrations (version) VALUES ('20120912170035'); - -INSERT INTO schema_migrations (version) VALUES ('20120913074940'); - -INSERT INTO schema_migrations (version) VALUES ('20120913080807'); - -INSERT INTO schema_migrations (version) VALUES ('20120913081136'); - -INSERT INTO schema_migrations (version) VALUES ('20120913135745'); - -INSERT INTO schema_migrations (version) VALUES ('20120919140404'); - -INSERT INTO schema_migrations (version) VALUES ('20121010214348'); - -INSERT INTO schema_migrations (version) VALUES ('20121022031914');
\ No newline at end of file diff --git a/doc/CHANGES.md b/doc/CHANGES.md index f0e98b1d7..4720e5283 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -1,3 +1,19 @@ +# Version 0.13 +## Highlighted features + +* Fix for bug that resulted in some incorrect results when using search by request status [issue #460](https://github.com/mysociety/alaveteli/issues/460). You can view and fix requests with inconsistent state history using `rake temp:fix_bad_request_states` +* All status updates (whether by the request owner or another user) are now logged in the event history, for better audit) (Matthew Landauer) +* Fix for bug that dropped accented characters from URLs [issue #282](https://github.com/mysociety/alaveteli/issues/282) (zejn) +* A fix for a bug that produced binary mask errors when handling multibyte characters in responses [issue #991](https://github.com/mysociety/alaveteli/issues/991) +* Some locale fixes for locales with a dash in them [issue #998](https://github.com/mysociety/alaveteli/issues/998) and [issue #999](https://github.com/mysociety/alaveteli/issues/999). +* Some improvements in the labelling of defunct authorities (Matthew Somerville) +* The addition of a check on the status of the commonlib submodule to the rails-post-deploy script. + +## Upgrade notes +* Check out this version and run `rails-post-deploy` as usual. +* This release includes an update to the commonlib submodule - you should now be warned about this on running `rails-post-deploy`. You can update to the nw version with `git submodule update`. +* After deploying, run `rake temp:fix_bad_request_states` to find and list requests that have an inconsistent history - run `rake temp:fix_bad_request_states DRYRUN=0` to fix them. + # Version 0.12 ## Highlighted features * Remove support for theme stylesheet inclusion via template (deprecated in version 0.5) @@ -7,8 +23,7 @@ * Internal review request text is now translatable * config/crontab.ugly is now config/crontab-example * Search query highlighting should now work with non-ascii characters [issue #505](https://github.com/mysociety/alaveteli/issues/505) (Matthew Landauer) -* A bug that allowed people to sign up with email addresses with spaces in them has been fixed [issue #980](https://github.com/mysociety/alaveteli/issues/980) - +* A bug that allowed people to sign up with email addresses with spaces in them has been fixed [issue #980](https://github.com/mysociety/alaveteli/issues/980). Any existing email addresses with spaces in them will cause problems e.g. when the cron scripts encounter them. You can fix them manually, or by running `rake temp:clean_up_emails_with_spaces` from `lib/tasks/temp.rake` * [List of issues on github](https://github.com/mysociety/alaveteli/issues?milestone=30&state=closed) ## Upgrade notes diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 578f90086..ea8871888 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -159,7 +159,8 @@ document, though we describe an example configuration for Exim in Note that in development mode, mail is handled by default by mailcatcher so that you can see the mails in a browser - see http://mailcatcher.me/ -for more details. +for more details. Start mailcatcher by running `bundle exec mailcatcher` +in your application directory. ## Minimal @@ -274,7 +275,7 @@ tests to pass by setting `export LD_PRELOAD=/lib/libuuid.so.1`. Run the following to get the server running: - script/server --environment=development + bundle exec rails server --environment=development By default the server listens on all interfaces. You can restrict it to the localhost interface by adding ` --binding=127.0.0.1` @@ -425,7 +426,7 @@ release. Failure to do so means that any new words added to the Alaveteli source code will appear in your website in English by default. If your translations didn't make it to the latest release, you will need to download the updated `app.po` for your locale from -Transifex and save it in the `locales/` folder. +Transifex and save it in the `locale/` folder. You should always run the script `scripts/rails-post-deploy` after each deployment. This runs any database migrations for you, plus diff --git a/lib/alaveteli_localization.rb b/lib/alaveteli_localization.rb new file mode 100644 index 000000000..6daab124a --- /dev/null +++ b/lib/alaveteli_localization.rb @@ -0,0 +1,21 @@ +class AlaveteliLocalization + class << self + def set_locales(available_locales, default_locale) + # fallback locale and available locales + available_locales = available_locales.split(/ /) + FastGettext.default_available_locales = available_locales + I18n.locale = default_locale + I18n.available_locales = available_locales.map { |locale_name| locale_name.to_sym } + I18n.default_locale = default_locale + end + + def set_default_text_domain(name, path) + FastGettext.add_text_domain name, :path => path, :type => :po + FastGettext.default_text_domain = name + end + + def set_default_locale_urls(include_default_locale_in_urls) + RoutingFilter::Locale.include_default_locale = include_default_locale_in_urls + end + end +end diff --git a/lib/i18n_fixes.rb b/lib/i18n_fixes.rb index 82d1b2c3a..9c1206215 100644 --- a/lib/i18n_fixes.rb +++ b/lib/i18n_fixes.rb @@ -17,7 +17,7 @@ end def n_(*keys) # The last parameter should be the values to do the interpolation with if keys.count > 3 - options = keys.pop + options = keys.pop else options = {} end @@ -33,7 +33,7 @@ def gettext_interpolate(string, values) safe = string.html_safe? string = string.to_str.gsub(MATCH) do pattern, key = $1, $1.to_sym - + if !values.include?(key) raise I18n::MissingInterpolationArgument.new(pattern, string) else @@ -50,7 +50,7 @@ end module I18n - # used by Globalize plugin. + # used by Globalize plugin. # XXX much of this stuff should (might?) be in newer versions of Rails @@fallbacks = nil class << self @@ -120,7 +120,7 @@ module I18n @defaults = defaults.map { |default| compute(default, false) }.flatten end attr_reader :defaults - + def [](locale) raise InvalidLocale.new(locale) if locale.nil? locale = locale.to_sym @@ -138,7 +138,7 @@ module I18n end protected - + def compute(tags, include_defaults = true) result = Array(tags).collect do |tag| tags = I18n::Locale::Tag::Simple.tag(tag).self_and_parents.map! { |t| t.to_sym } @@ -161,7 +161,18 @@ module GettextI18nRails class Backend def available_locales FastGettext.available_locales.map{|l| l.to_sym} || [] - end + end end end +# Monkeypatch Globalize to compensate for the way gettext_i18n_rails patches +# I18n.locale= so that it changes underscores in locale names (as used in the gettext world) +# to the dashes that I18n prefers +module Globalize + class << self + def locale + read_locale || I18n.locale.to_s.gsub('-', '_').to_sym + end + end +end + diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb index 87d8710f7..029331802 100644 --- a/lib/mail_handler/backends/mail_extensions.rb +++ b/lib/mail_handler/backends/mail_extensions.rb @@ -87,7 +87,10 @@ module Mail # invalid character at the end of the string, even # with UTF-8//IGNORE: # http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ - str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str + " ")[0...-4] + begin + str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str + " ")[0...-4] + rescue Iconv::InvalidEncoding + end end str end @@ -123,6 +126,21 @@ module Mail end class Ruby19 + def Ruby19.b_value_decode(str) + match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m) + if match + encoding = match[1] + str = Ruby19.decode_base64(match[2]) + # Rescue an ArgumentError arising from an unknown encoding. + begin + str.force_encoding(fix_encoding(encoding)) + rescue ArgumentError + end + end + decoded = str.encode("utf-8", :invalid => :replace, :replace => "") + decoded.valid_encoding? ? decoded : decoded.encode("utf-16le", :invalid => :replace, :replace => "").encode("utf-8") + end + def Ruby19.q_value_decode(str) match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m) if match diff --git a/lib/routing_filters.rb b/lib/routing_filters.rb index 32dafc651..a9a62b8db 100644 --- a/lib/routing_filters.rb +++ b/lib/routing_filters.rb @@ -7,7 +7,7 @@ module RoutingFilter end # And override the generation logic to use FastGettext.locale # rather than I18n.locale (the latter is what rails uses - # internally and may look like `en_US`, whereas the latter is + # internally and may look like `en-US`, whereas the latter is # was FastGettext and other POSIX-based systems use, and will # look like `en_US` def around_generate(*args, &block) diff --git a/lib/tasks/submodules.rake b/lib/tasks/submodules.rake new file mode 100644 index 000000000..426192713 --- /dev/null +++ b/lib/tasks/submodules.rake @@ -0,0 +1,28 @@ + +namespace :submodules do + + desc "Check the status of the project's submodules" + task :check => :environment do + commit_info = `git submodule status commonlib` + case commit_info[0,1] + when '+' + $stderr.puts "Error: Currently checked out submodule commit for commonlib" + $stderr.puts "does not match the commit expected by this version of Alaveteli." + $stderr.puts "You can update it with 'git submodule update'." + exit(1) + when '-' + $stderr.puts "Error: Submodule commonlib needs to be initialized." + $stderr.puts "You can do this by running 'git submodule update --init'." + exit(1) + when 'U' + $stderr.puts "Error: Submodule commonlib has merge conflicts." + $stderr.puts "You'll need to resolve these to run Alaveteli." + exit(1) + when ' ' + exit(0) + else + raise "Unexpected status character in response to 'git submodule status commonlib': #{commit_info[0,1]}" + end + end + +end diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake index fcabb23de..f746338f0 100644 --- a/lib/tasks/temp.rake +++ b/lib/tasks/temp.rake @@ -1,5 +1,36 @@ namespace :temp do + desc "Fix the history of requests where the described state doesn't match the latest status value + used by search, by adding an edit event that will correct the latest status" + task :fix_bad_request_states => :environment do + dryrun = ENV['DRYRUN'] != '0' + if dryrun + puts "This is a dryrun" + end + + InfoRequest.find_each() do |info_request| + next if info_request.url_title == 'holding_pen' + last_info_request_event = info_request.info_request_events[-1] + if last_info_request_event.latest_status != info_request.described_state + puts "#{info_request.id} #{info_request.url_title} #{last_info_request_event.latest_status} #{info_request.described_state}" + params = { :script => 'rake temp:fix_bad_request_states', + :user_id => nil, + :old_described_state => info_request.described_state, + :described_state => info_request.described_state + } + if ! dryrun + info_request.info_request_events.create!(:last_described_at => last_info_request_event.described_at + 1.second, + :event_type => 'status_update', + :described_state => info_request.described_state, + :calculated_state => info_request.described_state, + :params => params) + info_request.info_request_events.each{ |event| event.mark_needs_xapian_index } + end + end + + end + end + def disable_duplicate_account(user, count, dryrun) dupe_email = "duplicateemail#{count}@example.com" puts "Updating #{user.email} to #{dupe_email} for user #{user.id}" @@ -13,15 +44,21 @@ namespace :temp do total_messages = 0 messages_to_reparse = 0 IncomingMessage.find_each :include => :foi_attachments do |im| - reparse = im.foi_attachments.any? { |fa| ! File.exists? fa.filepath } - total_messages += 1 - messages_to_reparse += 1 if reparse - if total_messages % 1000 == 0 - puts "Considered #{total_messages} received emails." - end - unless dry_run - im.parse_raw_email! true if reparse - sleep 2 + begin + reparse = im.foi_attachments.any? { |fa| ! File.exists? fa.filepath } + total_messages += 1 + messages_to_reparse += 1 if reparse + if total_messages % 1000 == 0 + puts "Considered #{total_messages} received emails." + end + unless dry_run + im.parse_raw_email! true if reparse + sleep 2 + end + rescue StandardError => e + puts "There was a #{e.class} exception reparsing IncomingMessage with ID #{im.id}" + puts e.backtrace + puts e.message end end message = dry_run ? "Would reparse" : "Reparsed" diff --git a/locale/aln/app.po b/locale/aln/app.po index 1cc4204d6..cbd7176d2 100644 --- a/locale/aln/app.po +++ b/locale/aln/app.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Albanian Gheg (http://www.transifex.com/projects/p/alaveteli/language/aln/)\n" "Language: aln\n" @@ -616,6 +616,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1848,6 +1851,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/app.pot b/locale/app.pot index 1a0db5649..ce29159cf 100644 --- a/locale/app.pot +++ b/locale/app.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: version 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" "PO-Revision-Date: 2011-10-09 01:10+0200\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -613,6 +613,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1845,6 +1848,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/ar/app.po b/locale/ar/app.po index fb1adb0cf..9f2d85538 100644 --- a/locale/ar/app.po +++ b/locale/ar/app.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Arabic (http://www.transifex.com/projects/p/alaveteli/language/ar/)\n" "Language: ar\n" @@ -621,6 +621,9 @@ msgstr "عزيزي {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "تاخر الاجابة على طلب حرية النفاذ الى المعلومة - " @@ -1857,6 +1860,12 @@ msgstr "طلبات المعلومات الشخصية و الطلبات المخ msgid "Requests or responses matching your saved search" msgstr "الطلبات أو الردود الموافقة لبحثك المسجل" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "الرد عبر البريد الإلكتروني" diff --git a/locale/bg/app.po b/locale/bg/app.po index b84bcadf8..6ea017f37 100644 --- a/locale/bg/app.po +++ b/locale/bg/app.po @@ -7,9 +7,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-08-02 16:19+0000\n" -"Last-Translator: mysociety <transifex@mysociety.org>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Bulgarian (http://www.transifex.com/projects/p/alaveteli/language/bg/)\n" "Language: bg\n" "MIME-Version: 1.0\n" @@ -614,6 +614,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1846,6 +1849,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/bs/app.po b/locale/bs/app.po index 8e0578251..ae935f74a 100644 --- a/locale/bs/app.po +++ b/locale/bs/app.po @@ -13,8 +13,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Bosnian (http://www.transifex.com/projects/p/alaveteli/language/bs/)\n" "Language: bs\n" @@ -664,6 +664,9 @@ msgstr "Poštovani {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Odgođen odgovor na Vaš Zahtjev o slobodnom pristupu informacijama - " @@ -1958,6 +1961,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Zahtjevi ili odgovori koji odgovaraju Vašoj spašenoj pretrazi" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Odgovoriti e-mailom" diff --git a/locale/ca/app.po b/locale/ca/app.po index b3fcc4701..228fbce1a 100644 --- a/locale/ca/app.po +++ b/locale/ca/app.po @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Catalan (http://www.transifex.com/projects/p/alaveteli/language/ca/)\n" "Language: ca\n" @@ -678,6 +678,9 @@ msgstr "Estimado {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Respuesta retrasada a tu solicitud de acceso a información - " @@ -1977,6 +1980,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Solicitudes o respuestas para tu búsqueda" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Contestar por correo" diff --git a/locale/cs/app.po b/locale/cs/app.po index c28785b8a..be89e29ba 100644 --- a/locale/cs/app.po +++ b/locale/cs/app.po @@ -19,9 +19,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-26 17:02+0000\n" -"Last-Translator: Hana Huntova <>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Czech (http://www.transifex.com/projects/p/alaveteli/language/cs/)\n" "Language: cs\n" "MIME-Version: 1.0\n" @@ -680,6 +680,9 @@ msgstr "" msgid "Default locale" msgstr "Původní nastavení" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Zpožděná odpověď na váš dotaz –" @@ -1958,6 +1961,12 @@ msgstr "Požadavky na informace osobního charakteru a obsah odporující dobrý msgid "Requests or responses matching your saved search" msgstr "Dotazy nebo odpovědi odpovídající vašemu uloženému hledání" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Odpovězte e-mailem" diff --git a/locale/cy/app.po b/locale/cy/app.po index 55ecd5061..ef4050f84 100644 --- a/locale/cy/app.po +++ b/locale/cy/app.po @@ -13,8 +13,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Welsh (http://www.transifex.com/projects/p/alaveteli/language/cy/)\n" "Language: cy\n" @@ -620,6 +620,9 @@ msgstr "Annwyl {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Ymateb i'ch cais Rh.G. a oedwyd -" @@ -1854,6 +1857,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/de/app.po b/locale/de/app.po index 201e32692..944401221 100644 --- a/locale/de/app.po +++ b/locale/de/app.po @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: German (http://www.transifex.com/projects/p/alaveteli/language/de/)\n" "Language: de\n" @@ -649,6 +649,9 @@ msgstr "Sehr geehrte / Sehr geehrter {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1904,6 +1907,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Zu Ihrer gespeicherten Suche passende Anfragen und Antworten" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Email-Antwort senden" diff --git a/locale/en/app.po b/locale/en/app.po index 5dcc9ce57..17cea227b 100644 --- a/locale/en/app.po +++ b/locale/en/app.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" "PO-Revision-Date: 2011-02-24 07:11-0000\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -614,6 +614,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1846,6 +1849,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/en_IE/app.po b/locale/en_IE/app.po index 729e74ba6..a9f46885a 100644 --- a/locale/en_IE/app.po +++ b/locale/en_IE/app.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: English (Ireland) (http://www.transifex.com/projects/p/alaveteli/language/en_IE/)\n" "Language: en_IE\n" @@ -618,6 +618,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1850,6 +1853,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/es/app.po b/locale/es/app.po index 4deafbf9f..bd0112c58 100644 --- a/locale/es/app.po +++ b/locale/es/app.po @@ -15,9 +15,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-26 22:11+0000\n" -"Last-Translator: David Cabo <david.cabo@gmail.com>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Spanish (http://www.transifex.com/projects/p/alaveteli/language/es/)\n" "Language: es\n" "MIME-Version: 1.0\n" @@ -700,6 +700,9 @@ msgstr "Estimado {{public_body_name}}," msgid "Default locale" msgstr "Locale por defecto" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Respuesta retrasada a tu solicitud de acceso a información - " @@ -1999,6 +2002,12 @@ msgstr "Solicitudes de informacion personal y solicitudes inapropiadas o espurea msgid "Requests or responses matching your saved search" msgstr "Solicitudes o respuestas para tu búsqueda" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Contestar por correo" diff --git a/locale/eu/app.po b/locale/eu/app.po index 4fec5d9e0..f3548e5af 100644 --- a/locale/eu/app.po +++ b/locale/eu/app.po @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Basque (http://www.transifex.com/projects/p/alaveteli/language/eu/)\n" "Language: eu\n" @@ -646,6 +646,9 @@ msgstr "{{public_body_name}} agurgarria," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Zure informaziorako sarbidearen eskabidea atzeratuta dabil - " @@ -1895,6 +1898,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Zure bilaketaren eskabideak edo erantzunak" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Emailez erantzun" diff --git a/locale/fi/app.po b/locale/fi/app.po index e994c6e0a..12a58281d 100644 --- a/locale/fi/app.po +++ b/locale/fi/app.po @@ -4,14 +4,16 @@ # # Translators: # apoikola <antti.poikola@gmail.com>, 2013 +# apoikola <antti.poikola@gmail.com>, 2013 +# Hamatti <juhamattisantala@gmail.com>, 2013 # Hamatti <juhamattisantala@gmail.com>, 2013 msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-28 16:03+0000\n" -"Last-Translator: Hamatti <juhamattisantala@gmail.com>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Finnish (http://www.transifex.com/projects/p/alaveteli/language/fi/)\n" "Language: fi\n" "MIME-Version: 1.0\n" @@ -616,6 +618,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1848,6 +1853,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/fr/app.po b/locale/fr/app.po index 9a96036ee..c6e427cb4 100644 --- a/locale/fr/app.po +++ b/locale/fr/app.po @@ -10,6 +10,7 @@ # sim51 <contact@bsimard.com>, 2013 # Bbear <borisjf@post.harvard.edu>, 2011 # cegall, 2013 +# cegall, 2013 # David Cabo <david.cabo@gmail.com>, 2013 # pchrzanowski <pierre.chrzanowski@gmail.com>, 2013 # pchrzanowski <pierre.chrzanowski@gmail.com>, 2013 @@ -29,9 +30,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-08-02 17:53+0000\n" -"Last-Translator: cegall\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: French (http://www.transifex.com/projects/p/alaveteli/language/fr/)\n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -640,6 +641,9 @@ msgstr "Cher {{public_body_name}}," msgid "Default locale" msgstr "Langue par défaut" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Retards de réponse à votre demande d'accès" @@ -1872,6 +1876,12 @@ msgstr "Les demandes de renseignements personnels et les demandes abusives ne so msgid "Requests or responses matching your saved search" msgstr "Les demandes ou les réponses correspondant à votre recherche sauvegardée" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Répondre par e-mail " diff --git a/locale/fr_CA/app.po b/locale/fr_CA/app.po index 82682e1e7..f2dd68c77 100644 --- a/locale/fr_CA/app.po +++ b/locale/fr_CA/app.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-16 08:33+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: French (Canada) (http://www.transifex.com/projects/p/alaveteli/language/fr_CA/)\n" "Language: fr_CA\n" @@ -614,6 +614,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1846,6 +1849,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/gl/app.po b/locale/gl/app.po index f6a2f97ea..c6469bb26 100644 --- a/locale/gl/app.po +++ b/locale/gl/app.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Galician (http://www.transifex.com/projects/p/alaveteli/language/gl/)\n" "Language: gl\n" @@ -678,6 +678,9 @@ msgstr "Estimado {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Respuesta retrasada a tu solicitud de acceso a información - " @@ -1977,6 +1980,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Solicitudes o respuestas para tu búsqueda" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Contestar por correo" diff --git a/locale/he_IL/app.po b/locale/he_IL/app.po index df7f94e1f..b09c0df9c 100644 --- a/locale/he_IL/app.po +++ b/locale/he_IL/app.po @@ -20,9 +20,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-20 11:58+0000\n" -"Last-Translator: yauzi <yair.uziel@gmail.com>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Hebrew (Israel) (http://www.transifex.com/projects/p/alaveteli/language/he_IL/)\n" "Language: he_IL\n" "MIME-Version: 1.0\n" @@ -629,6 +629,9 @@ msgstr "{{public_body_name}} נכבד, " msgid "Default locale" msgstr "ברירת מחדל של הגדרות מקומיות" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "עיכוב בתגובה לבקשה" @@ -1861,6 +1864,12 @@ msgstr "בקשות למידע אישי ובקשות מטרידות אינן קב msgid "Requests or responses matching your saved search" msgstr "בקשות או תגובות המתאימות לחיפוש השמור שלך." +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "הגיבו בדוא\"ל" diff --git a/locale/hr/app.po b/locale/hr/app.po index 32a0bde69..dcfa98233 100644 --- a/locale/hr/app.po +++ b/locale/hr/app.po @@ -4,14 +4,16 @@ # # Translators: # BojanOpacak <bojan@rationalinternational.net>, 2013 +# BojanOpacak <bojan@rationalinternational.net>, 2013 +# vanjas <vanja@gong.hr>, 2013 # vanjas <vanja@gong.hr>, 2013 msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-04 08:55+0000\n" -"Last-Translator: BojanOpacak <bojan@rationalinternational.net>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Croatian (http://www.transifex.com/projects/p/alaveteli/language/hr/)\n" "Language: hr\n" "MIME-Version: 1.0\n" @@ -660,6 +662,9 @@ msgstr "Poštovani {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Odgođen odgovor na Vaš Zahtjev o slobodnom pristupu informacijama - " @@ -1954,6 +1959,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Zahtjevi ili odgovori koji odgovaraju Vašoj spašenoj pretrazi" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Odgovoriti e-mailom" diff --git a/locale/hr_HR/app.po b/locale/hr_HR/app.po index 3fe2b1a3a..1e3b6386c 100644 --- a/locale/hr_HR/app.po +++ b/locale/hr_HR/app.po @@ -4,15 +4,16 @@ # # Translators: # BojanOpacak <bojan@rationalinternational.net>, 2013 +# BojanOpacak <bojan@rationalinternational.net>, 2013 # louisecrow <louise@mysociety.org>, 2013 # louisecrow <louise@mysociety.org>, 2013 msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-26 13:19+0000\n" -"Last-Translator: BojanOpacak <bojan@rationalinternational.net>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Croatian (Croatia) (http://www.transifex.com/projects/p/alaveteli/language/hr_HR/)\n" "Language: hr_HR\n" "MIME-Version: 1.0\n" @@ -617,6 +618,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1850,6 +1854,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/hu_HU/app.po b/locale/hu_HU/app.po index 86574e9a4..6f1c025a5 100644 --- a/locale/hu_HU/app.po +++ b/locale/hu_HU/app.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Hungarian (Hungary) (http://www.transifex.com/projects/p/alaveteli/language/hu_HU/)\n" "Language: hu_HU\n" @@ -670,6 +670,9 @@ msgstr "Tisztelt {{public_body_name}}! " msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Késedelmes válasz a közérdekű adatok igénylésére - " @@ -1978,6 +1981,12 @@ msgstr "Személyes információk kérése vagy zaklatásnak minősülő igényl msgid "Requests or responses matching your saved search" msgstr "Az ön által beállított keresési feltételeknek megfelelő igénylések vagy válaszok " +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Válasz küldése e-mailben " diff --git a/locale/id/app.po b/locale/id/app.po index f17fadcc9..626c7d0a3 100644 --- a/locale/id/app.po +++ b/locale/id/app.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Indonesian (http://www.transifex.com/projects/p/alaveteli/language/id/)\n" "Language: id\n" @@ -698,6 +698,9 @@ msgstr "Yang terhormat {{public_body_name}}," msgid "Default locale" msgstr "Locale default" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Respon yang tertunda atas permintaan FOI Anda - " @@ -2001,6 +2004,12 @@ msgstr "Permintaan informasi pribadi dan permintaan tidak sopan dianggap tidak s msgid "Requests or responses matching your saved search" msgstr "Pemintaan atau respon yang cocok dengan pencarian yang telah disimpan" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Merespon lewat email" diff --git a/locale/it/app.po b/locale/it/app.po index bbfbe40a0..d31d97961 100644 --- a/locale/it/app.po +++ b/locale/it/app.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Italian (http://www.transifex.com/projects/p/alaveteli/language/it/)\n" "Language: it\n" @@ -616,6 +616,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1848,6 +1851,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/nb_NO/app.po b/locale/nb_NO/app.po index efb0176e0..e1dd8b408 100644 --- a/locale/nb_NO/app.po +++ b/locale/nb_NO/app.po @@ -7,9 +7,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-08-03 09:03+0000\n" -"Last-Translator: gorm <gormer@gmail.com>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Norwegian Bokmål (Norway) (http://www.transifex.com/projects/p/alaveteli/language/nb_NO/)\n" "Language: nb_NO\n" "MIME-Version: 1.0\n" @@ -616,6 +616,9 @@ msgstr "Kjære {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1848,6 +1851,12 @@ msgstr "Henvendelser om personlig informasjon og sjikanøse henvendelser er ikke msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Svar med epost" diff --git a/locale/nl/app.po b/locale/nl/app.po index 122196e5c..2c211512e 100644 --- a/locale/nl/app.po +++ b/locale/nl/app.po @@ -8,9 +8,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-28 10:58+0000\n" -"Last-Translator: Edwin Bosveld <edwin@inwy.nl>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Dutch (http://www.transifex.com/projects/p/alaveteli/language/nl/)\n" "Language: nl\n" "MIME-Version: 1.0\n" @@ -615,6 +615,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1847,6 +1850,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/pt_BR/app.po b/locale/pt_BR/app.po index a8448e85c..6b040cef5 100644 --- a/locale/pt_BR/app.po +++ b/locale/pt_BR/app.po @@ -12,6 +12,7 @@ # danielabsilva <danielabsilva@gmail.com>, 2011 # danielabsilva <danielabsilva@gmail.com>, 2011 # Daniela Mattern <3laste2000@gmail.com>, 2012 +# Daniela Mattern <3laste2000@gmail.com>, 2012 # <everton137@gmail.com>, 2011 # gabinardy <gabileitao@gmail.com>, 2012 # gabinardy <gabileitao@gmail.com>, 2012 @@ -41,8 +42,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/alaveteli/language/pt_BR/)\n" "Language: pt_BR\n" @@ -666,6 +667,9 @@ msgstr "Prezado(a) {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "A resposta ao seu pedido de informação está atrasada." @@ -1909,6 +1913,12 @@ msgstr "Pedidos de informação pessoal ou constrangedora não são considerados msgid "Requests or responses matching your saved search" msgstr "Pedidos ou respostas que correspondem a sua pesquisa" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Resposta por e-mail" diff --git a/locale/ro_RO/app.po b/locale/ro_RO/app.po index 0ba75b6a6..d553d3d36 100644 --- a/locale/ro_RO/app.po +++ b/locale/ro_RO/app.po @@ -21,9 +21,9 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-07 22:47+0000\n" -"Last-Translator: elena.calistru <calistru.elena@gmail.com>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/alaveteli/language/ro_RO/)\n" "Language: ro_RO\n" "MIME-Version: 1.0\n" @@ -628,6 +628,9 @@ msgstr "Stimată {{public_body_name}}," msgid "Default locale" msgstr "Default locale" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Amânare răspuns la cererea ta de acces la informații - " @@ -1863,6 +1866,12 @@ msgstr "Solicitările de informații personale și solicitările ofensatoare nu msgid "Requests or responses matching your saved search" msgstr "Solicitări sau răspunsuri care se potrivesc cu căutarea ta" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Răspuns prin email" diff --git a/locale/sl/app.po b/locale/sl/app.po index 2b042fbe0..4b16e7f88 100644 --- a/locale/sl/app.po +++ b/locale/sl/app.po @@ -4,13 +4,14 @@ # # Translators: # zejn <zejn@kiberpipa.org>, 2013 +# zejn <zejn@kiberpipa.org>, 2013 msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-07-11 11:02+0000\n" -"Last-Translator: zejn <zejn@kiberpipa.org>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:09+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Slovenian (http://www.transifex.com/projects/p/alaveteli/language/sl/)\n" "Language: sl\n" "MIME-Version: 1.0\n" @@ -615,6 +616,9 @@ msgstr "Dragi {{public_body_name}}," msgid "Default locale" msgstr "Privzete jezikovne nastavitve" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Pozen odgovor na vaš zahtevek - " @@ -1849,6 +1853,12 @@ msgstr "Zahtevki za osebne podatke in provokativni zahtevki se ne smatrajo za ve msgid "Requests or responses matching your saved search" msgstr "Zahtevki in odgovori, ki ustrezajo vašemu shranjenemu iskanju" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Odgovorite prek e-pošte" @@ -3047,10 +3057,7 @@ msgid "[{{site_name}} contact email]" msgstr "[{{site_name}} kontaktna epošta]" msgid "\\n\\n[ {{site_name}} note: The above text was badly encoded, and has had strange characters removed. ]" -msgstr "" -"\n" -"\n" -"[ {{site_name}} note: Zgornje besedilo je bilo zapisano v napačnem kodnem zapisu, zato so bili okvarjeni znaki odstranjeni. ]" +msgstr "\\n\\n[ {{site_name}} note: Zgornje besedilo je bilo zapisano v napačnem kodnem zapisu, zato so bili okvarjeni znaki odstranjeni. ]" msgid "a one line summary of the information you are requesting, \\n\t\t\te.g." msgstr "povzetek informacij, ki jih zahtevate, v eni vrstici, \\n npr." diff --git a/locale/sq/app.po b/locale/sq/app.po index aee8a89f9..9f54c3208 100644 --- a/locale/sq/app.po +++ b/locale/sq/app.po @@ -17,8 +17,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Albanian (http://www.transifex.com/projects/p/alaveteli/language/sq/)\n" "Language: sq\n" @@ -670,6 +670,9 @@ msgstr "Të nderuar {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Përgjigje e vonuar në kërkesën tënde - " @@ -1953,6 +1956,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Kërkesat ose përgjigjet që përputhen me kërkimin e ruajtur" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Përgjigju me email" diff --git a/locale/sr@latin/app.po b/locale/sr@latin/app.po index 67b18f47a..ce5e2a979 100644 --- a/locale/sr@latin/app.po +++ b/locale/sr@latin/app.po @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Serbian (Latin) (http://www.transifex.com/projects/p/alaveteli/language/sr@latin/)\n" "Language: sr@latin\n" @@ -661,6 +661,9 @@ msgstr "Poštovani {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Odgođen odgovor na Vaš Zahtev o slobodnom pristupu informacijama - " @@ -1955,6 +1958,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "Zahtevi ili odgovori koji odgovaraju Vašoj spašenoj pretrazi" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Odgovoriti e-mailom" diff --git a/locale/tr/app.po b/locale/tr/app.po index 364619764..173a51745 100644 --- a/locale/tr/app.po +++ b/locale/tr/app.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Turkish (http://www.transifex.com/projects/p/alaveteli/language/tr/)\n" "Language: tr\n" @@ -616,6 +616,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1848,6 +1851,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/locale/uk/app.po b/locale/uk/app.po index 3af5cd5b0..cff61afbf 100644 --- a/locale/uk/app.po +++ b/locale/uk/app.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-06-24 16:52+0000\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" "Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Ukrainian (http://www.transifex.com/projects/p/alaveteli/language/uk/)\n" "Language: uk\n" @@ -677,6 +677,9 @@ msgstr "Шановний {{public_body_name}}," msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "Відстрочена відповідь на ваш запит - " @@ -1963,6 +1966,12 @@ msgstr "Запити про особисту інформацію або без msgid "Requests or responses matching your saved search" msgstr "Запити або відповіді, що відповідають вашому збереженому пошуку" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "Відповісти електронною поштою" diff --git a/locale/vi/app.po b/locale/vi/app.po index 638eb4d3c..9351475cb 100644 --- a/locale/vi/app.po +++ b/locale/vi/app.po @@ -4,13 +4,14 @@ # # Translators: # ppanhh <ppanhh@gmail.com>, 2013 +# ppanhh <ppanhh@gmail.com>, 2013 msgid "" msgstr "" "Project-Id-Version: alaveteli\n" "Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n" -"POT-Creation-Date: 2013-06-24 09:40-0700\n" -"PO-Revision-Date: 2013-08-01 10:02+0000\n" -"Last-Translator: ppanhh <ppanhh@gmail.com>\n" +"POT-Creation-Date: 2013-08-05 17:01+0100\n" +"PO-Revision-Date: 2013-08-05 16:04+0000\n" +"Last-Translator: louisecrow <louise@mysociety.org>\n" "Language-Team: Vietnamese (http://www.transifex.com/projects/p/alaveteli/language/vi/)\n" "Language: vi\n" "MIME-Version: 1.0\n" @@ -615,6 +616,9 @@ msgstr "" msgid "Default locale" msgstr "" +msgid "Defunct." +msgstr "" + msgid "Delayed response to your FOI request - " msgstr "" @@ -1846,6 +1850,12 @@ msgstr "" msgid "Requests or responses matching your saved search" msgstr "" +msgid "Requests similar to '{{request_title}}'" +msgstr "" + +msgid "Requests similar to '{{request_title}}' (page {{page}})" +msgstr "" + msgid "Respond by email" msgstr "" diff --git a/script/load-sample-data b/script/load-sample-data index e91516886..c9e5997f5 100755 --- a/script/load-sample-data +++ b/script/load-sample-data @@ -5,22 +5,20 @@ # have a filesystem representation of their contents export LOC=`dirname "$0"` - bundle exec rails runner /dev/stdin <<END require 'rspec/rails' -require "#{ENV['LOC']}/../spec/support/load_file_fixtures.rb" -require "#{ENV['LOC']}/../spec/support/email_helpers.rb" +require Rails.root.join("spec", "support", "load_file_fixtures") +require Rails.root.join("spec", "support", "email_helpers") RSpec.configure do |config| - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_path = Rails.root.join("spec","fixtures") end # HACK: Normally to load fixtures you'd run `rake db:fixtures:load` but since we # have .csv files in the fixtures folder Rails tries to load those too. Therefore # we've pinched some code to load the fixtures: # https://github.com/rails/rails/blob/v3.1.11/activerecord/lib/active_record/railties/databases.rake#L311 -fixtures_dir = "#{ENV['LOC']}/../spec/fixtures" - +fixtures_dir = Rails.root.join("spec","fixtures").to_s Dir["#{fixtures_dir}/**/*.yml"].each do |fixture_file| ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file[(fixtures_dir.size + 1)..-5]) end diff --git a/script/rails-post-deploy b/script/rails-post-deploy index f7ed8178b..6eca2f68f 100755 --- a/script/rails-post-deploy +++ b/script/rails-post-deploy @@ -91,6 +91,8 @@ then fi bundle install $bundle_install_options +bundle exec rake submodules:check + # upgrade database bundle exec rake db:migrate #--trace diff --git a/script/runner b/script/runner index 32a0e6b7e..02735531a 100755 --- a/script/runner +++ b/script/runner @@ -35,6 +35,6 @@ Dir.chdir(alaveteli_dir) do Process.detach(pid) else # Not daemon mode - exec("bundle exec rails runner #{ARGV[1]}") + exec("bundle exec rails runner #{ARGV[0]}") end end diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb index 66b8e33f0..8e9d17fbe 100644 --- a/spec/controllers/api_controller_spec.rb +++ b/spec/controllers/api_controller_spec.rb @@ -83,6 +83,9 @@ describe ApiController, "when using the API" do new_request.last_event_forming_initial_request.outgoing_message.body.should == request_data["body"].strip new_request.public_body_id.should == public_bodies(:geraldine_public_body).id + new_request.info_request_events.size.should == 1 + new_request.info_request_events[0].event_type.should == 'sent' + new_request.info_request_events[0].calculated_state.should == 'waiting_response' end def _create_request diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index 0eda73c51..8c86ad0be 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -108,97 +108,15 @@ describe GeneralController, "when showing the frontpage" do response.should be_success end - describe 'when there is more than one locale' do - - describe 'when using the default locale' do - - before do - @default_lang_home_link = /href=".*\/en\// - @other_lang_home_link = /href=".*\/es\// - @old_include_default_locale_in_urls = AlaveteliConfiguration::include_default_locale_in_urls - end - - def set_default_locale_in_urls(value) - AlaveteliConfiguration.stub!(:include_default_locale_in_urls).and_return(value) - load Rails.root.join("config/initializers/fast_gettext.rb") - end - - describe 'when the config value INCLUDE_DEFAULT_LOCALE_IN_URLS is false' do - - before do - set_default_locale_in_urls(false) - end - - it 'should generate URLs without a locale prepended' do - get :frontpage - response.should_not contain @default_lang_home_link - end - - it 'should render the front page in the default language when no locale param - is present and the session locale is not the default' do - get(:frontpage, {}, {:locale => 'es'}) - response.should_not contain @other_lang_home_link - end - end - - it 'should generate URLs with a locale prepended when the config value - INCLUDE_DEFAULT_LOCALE_IN_URLS is true' do - set_default_locale_in_urls(true) - get :frontpage - response.body.should match /#{@default_lang_home_link}/ - end - - after do - set_default_locale_in_urls(@old_include_default_locale_in_urls) - end - - end - end - - - describe "when using different locale settings" do - home_link_regex = /href=".*\/en\// - - it "should generate URLs with a locale prepended when there's more than one locale set" do - get :frontpage - response.body.should match home_link_regex - end + describe 'when using locales' do it "should use our test PO files rather than the application one" do - I18n.default_locale = :es - get :frontpage + get :frontpage, :locale => 'es' response.body.should match /XOXO/ - I18n.default_locale = :en - end - - it "should generate URLs that include the locale when using one that includes an underscore" do - I18n.default_locale = :"en_GB" - get :frontpage - response.body.should match /href="\/en_GB\// - I18n.default_locale = :en - end - - it "should fall back to the language if the territory is unknown" do - I18n.default_locale = :"en_US" - get :frontpage - response.body.should match /href="\/en\// - response.body.should_not match /href="\/en_US\// - I18n.default_locale = :en - end - - it "should generate URLs without a locale prepended when there's only one locale set" do - old_fgt_available_locales = FastGettext.default_available_locales - old_i18n_available_locales = I18n.available_locales - FastGettext.default_available_locales = I18n.available_locales = ['en'] - - get :frontpage - response.should_not contain home_link_regex - - FastGettext.default_available_locales = old_fgt_available_locales - I18n.available_locales = old_i18n_available_locales end end + end describe GeneralController, "when showing the front page with fixture data" do diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index c47e1abd3..cc024f840 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -31,17 +31,11 @@ describe HelpController, "when using help" do describe 'when requesting a page in a supported locale ' do before do - # Allow us to supply the locale manually - RoutingFilter.active = false # Prepend our fixture templates fixture_theme_path = File.join(Rails.root, 'spec', 'fixtures', 'theme_views', 'theme_one') controller.prepend_view_path fixture_theme_path end - after do - RoutingFilter.active = true - end - it 'should render the locale-specific template if available' do get :contact, {:locale => 'es'} response.body.should match('contáctenos theme one') diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index e01bcb0a6..4e1841164 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -43,28 +43,20 @@ describe PublicBodyController, "when showing a body" do :conditions => ["public_body_id = ?", public_bodies(:humpadink_public_body).id]) end - it "should redirect to the canonical name in the chosen locale" do - get :show, {:url_name => "dfh", :view => 'all', :show_locale => "es"} - response.should redirect_to "http://test.host/es/body/edfh" + it "should display the body using same locale as that used in url_name" do + get :show, {:url_name => "edfh", :view => 'all', :locale => "es"} + response.should contain("Baguette") end - it "should assign the body using same locale as that used in url_name" do - get :show, {:url_name => "edfh", :view => 'all', :show_locale => "es"} - response.should contain("Baguette") + it 'should show public body names in the selected locale language if present for a locale with underscores' do + AlaveteliLocalization.set_locales('he_IL en', 'en') + get :show, {:url_name => 'dfh', :view => 'all', :locale => 'he_IL'} + response.should contain('Hebrew Humpadinking') end it "should redirect use to the relevant locale even when url_name is for a different locale" do - RoutingFilter.active = false - get :show, {:url_name => "edfh", :view => 'all'} response.should redirect_to "http://test.host/body/dfh" - - RoutingFilter.active = true - end - - it "should remember the filter (view) setting on redirecting" do - get :show, :show_locale => "es", :url_name => "tgq", :view => 'successful' - response.should redirect_to 'http://test.host/es/body/etgq/successful' end it "should redirect to newest name if you use historic name of public body in URL" do @@ -95,12 +87,22 @@ describe PublicBodyController, "when listing bodies" do :last_edit_comment => '') @english_only.save end - I18n.with_locale(:es) do - get :list - assigns[:public_bodies].include?(@english_only).should == true - end + get :list, {:locale => 'es'} + assigns[:public_bodies].include?(@english_only).should == true + end + + it 'should show public body names in the selected locale language if present' do + get :list, {:locale => 'es'} + response.should contain('El Department for Humpadinking') end + it 'should show public body names in the selected locale language if present for a locale with underscores' do + AlaveteliLocalization.set_locales('he_IL en', 'en') + get :list, {:locale => 'he_IL'} + response.should contain('Hebrew Humpadinking') + end + + it "should list bodies in alphabetical order" do # Note that they are alphabetised by localised name get :list diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index c73576c50..2c605a139 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1519,8 +1519,8 @@ describe RequestController, "when classifying an information request" do post_status('rejected') end - it 'should not log a status update event' do - @dog_request.should_not_receive(:log_event) + it 'should log a status update event' do + @dog_request.should_receive(:log_event) post_status('rejected') end @@ -1573,11 +1573,12 @@ describe RequestController, "when classifying an information request" do @dog_request.awaiting_description.should == false @dog_request.described_state.should == 'rejected' @dog_request.get_last_response_event.should == info_request_events(:useless_incoming_message_event) - @dog_request.get_last_response_event.calculated_state.should == 'rejected' + @dog_request.info_request_events.last.event_type.should == "status_update" + @dog_request.info_request_events.last.calculated_state.should == 'rejected' end - it 'should not log a status update event' do - @dog_request.should_not_receive(:log_event) + it 'should log a status update event' do + @dog_request.should_receive(:log_event) post_status('rejected') end @@ -1645,10 +1646,6 @@ describe RequestController, "when classifying an information request" do @dog_request = info_requests(:fancy_dog_request) @dog_request.stub!(:each).and_return([@dog_request]) InfoRequest.stub!(:find).and_return(@dog_request) - RoutingFilter.active = false - end - after do - RoutingFilter.active = true end def request_url diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 1575bc84e..a16024828 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -64,8 +64,6 @@ describe TrackController, "when sending alerts for a track" do end it "should send alerts" do - # Don't do clever locale-insertion-unto-URL stuff - RoutingFilter.active = false # set the time the comment event happened at to within the last week ire = info_request_events(:silly_comment_event) @@ -111,9 +109,6 @@ describe TrackController, "when sending alerts for a track" do TrackMailer.alert_tracks deliveries = ActionMailer::Base.deliveries deliveries.size.should == 0 - - # Restore the routing filters - RoutingFilter.active = true end it "should send localised alerts" do diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index b09594b9c..0033309a5 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -3,6 +3,31 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') # XXX Use route_for or params_from to check /c/ links better # http://rspec.rubyforge.org/rspec-rails/1.1.12/classes/Spec/Rails/Example/ControllerExampleGroup.html +describe UserController, "when redirecting a show request to a canonical url" do + + it "should redirect to lower case name if given one with capital letters" do + get :show, :url_name => "Bob_Smith" + response.should redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith") + end + + it 'should redirect a long non-canonical name that has a numerical suffix, + retaining the suffix' do + get :show, :url_name => 'Bob_SmithBob_SmithBob_SmithBob_S_2' + response.should redirect_to(:controller => 'user', + :action => 'show', + :url_name => 'bob_smithbob_smithbob_smithbob_s_2') + end + + it 'should not redirect a long canonical name that has a numerical suffix' do + User.stub!(:find).with(:first, anything()).and_return(mock_model(User, + :url_name => 'bob_smithbob_smithbob_smithbob_s_2', + :name => 'Bob Smith Bob Smith Bob Smith Bob Smith')) + User.stub!(:find).with(:all, anything()).and_return([]) + get :show, :url_name => 'bob_smithbob_smithbob_smithbob_s_2' + response.should be_success + end + +end describe UserController, "when showing a user" do render_views @@ -16,11 +41,6 @@ describe UserController, "when showing a user" do response.should be_success end - it "should redirect to lower case name if given one with capital letters" do - get :show, :url_name => "Bob_Smith" - response.should redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith") - end - it "should render with 'show' template" do get :show, :url_name => "bob_smith" response.should render_template('show') @@ -105,8 +125,6 @@ describe UserController, "when signing in" do end it "should log in when you give right email/password, and redirect to where you were" do - RoutingFilter.active = false - get :signin, :r => "/list" response.should render_template('sign') post_redirect = get_last_postredirect @@ -117,13 +135,9 @@ describe UserController, "when signing in" do # response doesn't contain /en/ but redirect_to does... response.should redirect_to(:controller => 'request', :action => 'list', :post_redirect => 1) ActionMailer::Base.deliveries.should be_empty - - RoutingFilter.active = true end it "should not log you in if you use an invalid PostRedirect token, and shouldn't give 500 error either" do - RoutingFilter.active = false - post_redirect = "something invalid" lambda { post :signin, { :user_signin => { :email => 'bob@localhost', :password => 'jonespassword' }, @@ -134,8 +148,6 @@ describe UserController, "when signing in" do :token => post_redirect } response.should render_template('sign') assigns[:post_redirect].should == nil - - RoutingFilter.active = true end # No idea how to test this in the test framework :( @@ -159,8 +171,6 @@ describe UserController, "when signing in" do end it "should confirm your email, log you in and redirect you to where you were after you click an email link" do - RoutingFilter.active = false - get :signin, :r => "/list" post_redirect = get_last_postredirect @@ -186,13 +196,9 @@ describe UserController, "when signing in" do get :confirm, :email_token => post_redirect.email_token session[:user_id].should == users(:unconfirmed_user).id response.should redirect_to(:controller => 'request', :action => 'list', :post_redirect => 1) - - RoutingFilter.active = true end it "should keep you logged in if you click a confirmation link and are already logged in as an admin" do - RoutingFilter.active = false - get :signin, :r => "/list" post_redirect = get_last_postredirect @@ -223,7 +229,6 @@ describe UserController, "when signing in" do # And the redirect should still work, of course response.should redirect_to(:controller => 'request', :action => 'list', :post_redirect => 1) - RoutingFilter.active = true end end @@ -301,14 +306,10 @@ describe UserController, "when signing out" do end it "should log you out and redirect you to where you were" do - RoutingFilter.active = false - session[:user_id] = users(:bob_smith_user).id get :signout, :r => '/list' session[:user_id].should be_nil response.should redirect_to(:controller => 'request', :action => 'list') - - RoutingFilter.active = true end end diff --git a/spec/fixtures/files/unrecognized-encoding-mail.email b/spec/fixtures/files/unrecognized-encoding-mail.email new file mode 100644 index 000000000..266a90fbc --- /dev/null +++ b/spec/fixtures/files/unrecognized-encoding-mail.email @@ -0,0 +1,36 @@ +From xxx@example.com Fri Jun 21 07:50:52 2013 +Return-path: <xxx@example.com> +Envelope-to: xxx@example.com +Delivery-date: Fri, 21 Jun 2013 07:50:52 +0100 +Message-ID: <185C0D48380D7AE612DD38A527D5EAF2@tmvbalem> +From: "cttlqvx" <xxx@example.com> +To: <xxx@example.com> +Subject: =?hz-gb-2312?B?fntPck9ISXpWQn59c3J5dW95d3MoQUQpICAgIA==?= +Date: Fri, 21 Jun 2013 14:48:20 +0800 +MIME-Version: 1.0 +Content-Type: multipart/related; + type="multipart/alternative"; + boundary="----=_NextPart_000_02ED_01A0462A.178683F0" +X-Priority: 1 +X-MSMail-Priority: High +X-Mailer: Microsoft Outlook Express 6.00.2900.5512 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 + +This is a multi-part message in MIME format. + +------=_NextPart_000_02ED_01A0462A.178683F0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_001_09EC_01A0462A.178683F0" + +------=_NextPart_001_09EC_01A0462A.178683F0 +Content-Type: text/plain; + charset="hz-gb-2312" +Content-Transfer-Encoding: base64 + + +------=_NextPart_001_09EC_01A0462A.178683F0 +Content-Type: text/html; + charset="hz-gb-2312" +Content-Transfer-Encoding: base64 + +------=_NextPart_001_09EC_01A0462A.178683F0-- diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml index 61e07fb5b..de1bf2f18 100644 --- a/spec/fixtures/public_body_translations.yml +++ b/spec/fixtures/public_body_translations.yml @@ -101,3 +101,17 @@ other_public_body_translation: notes: More notes publication_scheme: "" disclosure_log: "" + +humpadink_he_IL_public_body_translation: + name: "Hebrew Humpadinking" + first_letter: D + request_email: humpadink-requests@localhost + id: 9 + public_body_id: 3 + short_name: DfH + url_name: dfh + locale: he_IL + notes: An albatross told me!!! + publication_scheme: "" + disclosure_log: "" + diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index 4cc1d415b..b29419ef3 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -8,12 +8,7 @@ describe LinkToHelper do before do @mock_request = mock_model(InfoRequest, :url_title => 'test_title') - RoutingFilter.active = false end - after do - RoutingFilter.active = true - end - it 'should return a path like /request/test_title' do request_path(@mock_request).should == '/request/test_title' diff --git a/spec/integration/localisation_spec.rb b/spec/integration/localisation_spec.rb new file mode 100644 index 000000000..4f6b61ae1 --- /dev/null +++ b/spec/integration/localisation_spec.rb @@ -0,0 +1,88 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe "when generating urls" do + + before do + @home_link_regex = /href=".*\/en\// + end + + it "should generate URLs that include the locale when using one that includes an underscore" do + get('/en_GB') + response.body.should match /href="\/en_GB\// + end + + it "should fall back to the language if the territory is unknown" do + AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en') + get('/', {}, {'HTTP_ACCEPT_LANGUAGE' => 'en_US'}) + response.body.should match /href="\/en\// + response.body.should_not match /href="\/en_US\// + end + + it "should generate URLs without a locale prepended when there's only one locale set" do + AlaveteliLocalization.set_locales(available_locales='en', default_locale='en') + get('/') + response.should_not contain @home_link_regex + end + + it 'should redirect requests for a public body in a locale to the canonical name in that locale' do + get('/es/body/dfh') + response.should redirect_to "/es/body/edfh" + end + + it 'should remember a filter view when redirecting a public body request to the canonical name' do + get('/es/body/tgq/successful') + response.should redirect_to "/es/body/etgq/successful" + end + + describe 'when there is more than one locale' do + + before do + AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en') + end + + it "should generate URLs with a locale prepended when there's more than one locale set" do + get('/') + response.body.should match @home_link_regex + end + + describe 'when using the default locale' do + + before do + @default_lang_home_link = /href=".*\/en\// + @other_lang_home_link = /href=".*\/es\// + @old_include_default_locale_in_urls = AlaveteliConfiguration::include_default_locale_in_urls + end + + describe 'when the config value INCLUDE_DEFAULT_LOCALE_IN_URLS is false' do + + before do + AlaveteliLocalization.set_default_locale_urls(false) + end + + it 'should generate URLs without a locale prepended' do + get '/' + response.should_not contain @default_lang_home_link + end + + it 'should render the front page in the default language when no locale param + is present and the session locale is not the default' do + get('/', {:locale => 'es'}) + response.should_not contain @other_lang_home_link + end + end + + it 'should generate URLs with a locale prepended when the config value + INCLUDE_DEFAULT_LOCALE_IN_URLS is true' do + AlaveteliLocalization.set_default_locale_urls(true) + get '/' + response.body.should match /#{@default_lang_home_link}/ + end + + after do + AlaveteliLocalization.set_default_locale_urls(@old_include_default_locale_in_urls) + end + + end + end + +end diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index 3e5176e87..aa351bd94 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -67,6 +67,11 @@ describe 'when creating a mail object from raw data' do body.should match(/ \xe2\x80\x93 /) end + it 'should not error on a subject line with an encoding encoding not recognized by iconv' do + mail = get_fixture_mail('unrecognized-encoding-mail.email') + lambda{ mail.subject }.should_not raise_error + end + end describe 'when asked for the from name' do diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 3c924dcb3..ff6a8e34e 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -328,7 +328,18 @@ describe IncomingMessage, " when censoring data" do data.should == "His email was x\000x\000x\000@\000x\000x\000x\000.\000x\000x\000x\000, indeed" end - + it 'should handle multibyte characters correctly', :focus => true do + orig_data = 'á' + data = orig_data.dup + @regex_censor_rule = CensorRule.new() + @regex_censor_rule.text = 'á' + @regex_censor_rule.regexp = true + @regex_censor_rule.replacement = 'cat' + @regex_censor_rule.last_edit_editor = 'unknown' + @regex_censor_rule.last_edit_comment = 'none' + @im.info_request.censor_rules << @regex_censor_rule + lambda{ @im.binary_mask_stuff!(data, "text/plain") }.should_not raise_error + end def pdf_replacement_test(use_ghostscript_compression) config = MySociety::Config.load_default() diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index f9ca44657..3451e018f 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -156,6 +156,7 @@ describe InfoRequest do end it "should cope with indexing after item is deleted" do + load_raw_emails_data IncomingMessage.find(:all).each{|x| x.parse_raw_email!} rebuild_xapian_index # delete event from underneath indexing; shouldn't cause error @@ -606,4 +607,254 @@ describe InfoRequest do @info_request.user_json_for_api.should == {:name => 'Anonymous user'} end end + describe "#set_described_state and #log_event" do + context "a request" do + let(:request) { InfoRequest.create!(:title => "my request", + :public_body => public_bodies(:geraldine_public_body), + :user => users(:bob_smith_user)) } + + context "a series of events on a request" do + it "should have sensible events after the initial request has been made" do + # An initial request is sent + # The logic that changes the status when a message is sent is mixed up + # in OutgoingMessage#send_message. So, rather than extract it (or call it) + # let's just duplicate what it does here for the time being. + request.log_event('sent', {}) + request.set_described_state('waiting_response') + + events = request.info_request_events + events.count.should == 1 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + end + + it "should have sensible events after a response is received to a request" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # A response is received + # This is normally done in InfoRequest#receive + request.awaiting_description = true + request.log_event("response", {}) + + events = request.info_request_events + events.count.should == 2 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "response" + events[1].described_state.should be_nil + # TODO: Should calculated_status in this situation be "waiting_classification"? + # This would allow searches like "latest_status: waiting_classification" to be + # available to the user in "Advanced search" + events[1].calculated_state.should be_nil + end + + it "should have sensible events after a request is classified by the requesting user" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # A response is received + request.awaiting_description = true + request.log_event("response", {}) + # The request is classified by the requesting user + # This is normally done in RequestController#describe_state + request.log_event("status_update", {}) + request.set_described_state("waiting_response") + + events = request.info_request_events + events.count.should == 3 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "response" + events[1].described_state.should be_nil + events[1].calculated_state.should == 'waiting_response' + events[2].event_type.should == "status_update" + events[2].described_state.should == "waiting_response" + events[2].calculated_state.should == "waiting_response" + end + + it "should have sensible events after a normal followup is sent" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # A response is received + request.awaiting_description = true + request.log_event("response", {}) + # The request is classified by the requesting user + request.log_event("status_update", {}) + request.set_described_state("waiting_response") + # A normal follow up is sent + # This is normally done in OutgoingMessage#send_message + request.log_event('followup_sent', {}) + request.set_described_state('waiting_response') + + events = request.info_request_events + events.count.should == 4 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "response" + events[1].described_state.should be_nil + events[1].calculated_state.should == 'waiting_response' + events[2].event_type.should == "status_update" + events[2].described_state.should == "waiting_response" + events[2].calculated_state.should == "waiting_response" + events[3].event_type.should == "followup_sent" + events[3].described_state.should == "waiting_response" + events[3].calculated_state.should == "waiting_response" + end + + it "should have sensible events after a user classifies the request after a follow up" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # A response is received + request.awaiting_description = true + request.log_event("response", {}) + # The request is classified by the requesting user + request.log_event("status_update", {}) + request.set_described_state("waiting_response") + # A normal follow up is sent + request.log_event('followup_sent', {}) + request.set_described_state('waiting_response') + # The request is classified by the requesting user + request.log_event("status_update", {}) + request.set_described_state("waiting_response") + + events = request.info_request_events + events.count.should == 5 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "response" + events[1].described_state.should be_nil + events[1].calculated_state.should == 'waiting_response' + events[2].event_type.should == "status_update" + events[2].described_state.should == "waiting_response" + events[2].calculated_state.should == "waiting_response" + events[3].event_type.should == "followup_sent" + events[3].described_state.should == "waiting_response" + events[3].calculated_state.should == "waiting_response" + events[4].event_type.should == "status_update" + events[4].described_state.should == "waiting_response" + events[4].calculated_state.should == "waiting_response" + end + end + + context "another series of events on a request" do + it "should have sensible event states" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # An internal review is requested + request.log_event('followup_sent', {}) + request.set_described_state('internal_review') + + events = request.info_request_events + events.count.should == 2 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "followup_sent" + events[1].described_state.should == "internal_review" + events[1].calculated_state.should == "internal_review" + end + + it "should have sensible event states" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # An internal review is requested + request.log_event('followup_sent', {}) + request.set_described_state('internal_review') + # The user marks the request as rejected + request.log_event("status_update", {}) + request.set_described_state("rejected") + + events = request.info_request_events + events.count.should == 3 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "followup_sent" + events[1].described_state.should == "internal_review" + events[1].calculated_state.should == "internal_review" + events[2].event_type.should == "status_update" + events[2].described_state.should == "rejected" + events[2].calculated_state.should == "rejected" + end + end + + context "another series of events on a request" do + it "should have sensible event states" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # The user marks the request as successful (I know silly but someone did + # this in https://www.whatdotheyknow.com/request/family_support_worker_redundanci) + request.log_event("status_update", {}) + request.set_described_state("successful") + + events = request.info_request_events + events.count.should == 2 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "status_update" + events[1].described_state.should == "successful" + events[1].calculated_state.should == "successful" + end + + it "should have sensible event states" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + + # A response is received + request.awaiting_description = true + request.log_event("response", {}) + + # The user marks the request as successful + request.log_event("status_update", {}) + request.set_described_state("successful") + + events = request.info_request_events + events.count.should == 3 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "response" + events[1].described_state.should be_nil + events[1].calculated_state.should == "successful" + events[2].event_type.should == "status_update" + events[2].described_state.should == "successful" + events[2].calculated_state.should == "successful" + end + end + + context "another series of events on a request", :focus => true do + it "should have sensible event states" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # An admin sets the status of the request to 'gone postal' using + # the admin interface + request.log_event("edit", {}) + request.set_described_state("gone_postal") + + events = request.info_request_events + events.count.should == 2 + events[0].event_type.should == "sent" + events[0].described_state.should == "waiting_response" + events[0].calculated_state.should == "waiting_response" + events[1].event_type.should == "edit" + events[1].described_state.should == "gone_postal" + events[1].calculated_state.should == "gone_postal" + end + end + end + end end diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index e17cf8e63..90affaaaa 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -468,7 +468,7 @@ end describe PublicBody, " when override all public body request emails set" do it "should return the overridden request email" do - MySociety::Config.should_receive(:get).with("OVERRIDE_ALL_PUBLIC_BODY_REQUEST_EMAILS", "").twice.and_return("catch_all_test_email@foo.com") + AlaveteliConfiguration.should_receive(:override_all_public_body_request_emails).twice.and_return("catch_all_test_email@foo.com") @geraldine = public_bodies(:geraldine_public_body) @geraldine.request_email.should == "catch_all_test_email@foo.com" end diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb index c40334142..7aab9cdc6 100644 --- a/spec/models/xapian_spec.rb +++ b/spec/models/xapian_spec.rb @@ -373,6 +373,11 @@ end # I would expect ActsAsXapian to have some tests under vendor/plugins/acts_as_xapian, but # it looks like this is not the case. Putting a test here instead. describe ActsAsXapian::Search, "#words_to_highlight" do + before(:each) do + load_raw_emails_data + get_fixtures_xapian_index + end + it "should return a list of words used in the search" do s = ActsAsXapian::Search.new([PublicBody], "albatross words", :limit => 100) s.words_to_highlight.should == ["albatross", "words"] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a3b06cea8..86ca5150a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,8 +31,7 @@ Spork.prefork do Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} # Use test-specific translations - FastGettext.add_text_domain 'app', :path => File.join(File.dirname(__FILE__), 'fixtures', 'locale'), :type => :po - FastGettext.default_text_domain = 'app' + AlaveteliLocalization.set_default_text_domain('app', File.join(File.dirname(__FILE__), 'fixtures', 'locale')) RSpec.configure do |config| # ## Mock Framework @@ -88,12 +87,19 @@ Spork.prefork do # ApplicationController#set_gettext_locale which sets the locale and so you may be setting # the locale in your tests and not even realising it. So, let's make things easier for # ourselves and just always restore the locale for all tests. + config.after(:each) do + AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales, + AlaveteliConfiguration::default_locale) + end + + # Turn routing-filter off in functional and unit tests as per + # https://github.com/svenfuchs/routing-filter/blob/master/README.markdown#testing config.before(:each) do - @save_i18n_locale = I18n.locale + RoutingFilter.active = false if [:controller, :helper, :model].include? example.metadata[:type] end config.after(:each) do - I18n.locale = @save_i18n_locale + RoutingFilter.active = true if [:controller, :helper, :model].include? example.metadata[:type] end # This section makes the garbage collector run less often to speed up tests |