diff options
-rw-r--r-- | app/controllers/comment_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/general_controller.rb | 9 | ||||
-rw-r--r-- | app/models/info_request.rb | 3 | ||||
-rw-r--r-- | app/models/public_body.rb | 9 | ||||
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 4 | ||||
-rw-r--r-- | app/views/request_mailer/old_unclassified_updated.rhtml | 6 | ||||
-rw-r--r-- | config/general-example | 4 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 4 |
9 files changed, 24 insertions, 19 deletions
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index 0bba0cfb8..86d5b0a06 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_controller.rb @@ -54,7 +54,7 @@ class CommentController < ApplicationController if authenticated?( :web => _("To post your annotation"), :email => _("Then your annotation to {{info_request_title}} will be posted.",:info_request_title=>@info_request.title), - :email_subject => _("Confirm your annotation to {{info_request_title}}",:info_request.title=>@info_request.title) + :email_subject => _("Confirm your annotation to {{info_request_title}}",:info_request_title=>@info_request.title) ) # Also subscribe to track for this request, so they get updates diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 21f3edbb1..17f39740f 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -26,10 +26,10 @@ class GeneralController < ApplicationController # get some example searches and public bodies to display # either from config, or based on a (slow!) query if not set body_short_names = MySociety::Config.get('FRONTPAGE_PUBLICBODY_EXAMPLES', '').split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ") - @locale = self.locale_from_params() - locale_condition = 'public_body_translations.locale = ?' + @locale = self.locale_from_params() + locale_condition = 'public_body_translations.locale = ?' conditions = [locale_condition, @locale] - PublicBody.with_locale(@locale) do + PublicBody.with_locale(@locale) do if body_short_names.empty? # This is too slow @popular_bodies = PublicBody.find(:all, @@ -40,8 +40,9 @@ class GeneralController < ApplicationController :joins => :translations ) else + conditions[0] += " and public_bodies.url_name in (" + body_short_names + ")" @popular_bodies = PublicBody.find(:all, - :conditions => conditions + ["url_name in (" + body_short_names + ")"], + :conditions => conditions, :joins => :translations) end end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index a36b140b8..b9c39e89d 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -612,7 +612,8 @@ public # last_event_forming_initial_request. There may be more obscure # things, e.g. fees, not properly covered. def date_response_required_by - return Holiday.due_date_from(self.date_initial_request_last_sent_at, 7) + days_later = MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20) + return Holiday.due_date_from(self.date_initial_request_last_sent_at, days_later) end # This is a long stop - even with UK public interest test extensions, 40 # days is a very long time. diff --git a/app/models/public_body.rb b/app/models/public_body.rb index b68722b81..8c749b1df 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -54,11 +54,12 @@ class PublicBody < ActiveRecord::Base # like find_by_url_name but also search historic url_name if none found def self.find_by_url_name_with_historic(name) - @localer = I18n.locale.to_s + @locale = I18n.locale.to_s PublicBody.with_locale(@locale) do - found = PublicBody.find(:all, - :conditions => ["public_body_translations.url_name='#{name}' AND public_body_translations.locale = '#{@localer}'"], - :joins => :translations) + found = PublicBody.find(:all, + :conditions => ["public_body_translations.url_name='#{name}'"], + :joins => :translations, + :readonly => false) return found.first if found.size == 1 # Shouldn't we just make url_name unique? raise "Two bodies with the same URL name: #{name}" if found.size > 1 diff --git a/app/models/user.rb b/app/models/user.rb index e199eb352..e29ae3101 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -103,7 +103,7 @@ class User < ActiveRecord::Base def validate if self.email != "" && !MySociety::Validate.is_valid_email(self.email) - errors.add(_("Please enter a valid email address")) + errors.add(:email, _("Please enter a valid email address")) end if MySociety::Validate.is_valid_email(self.name) errors.add(:name, _("Please enter your name, not your email address, in the name field.")) diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index f1bee3ba1..241ecf2a9 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -29,12 +29,14 @@ <div id="frontpage_examples"> <% if @popular_bodies.size > 0 %> - <div id="examples_0"> + <div id="examples_0"> + <ul> <% for popular_body in @popular_bodies %> <li><%=public_body_link(popular_body)%> <%= n_('%d request', '%d requests', popular_body.info_requests.count) % popular_body.info_requests.count %> </li> <% end%> + </ul> <p><strong> <%= link_to _('More authorities...'), list_public_bodies_default %> </strong></p> diff --git a/app/views/request_mailer/old_unclassified_updated.rhtml b/app/views/request_mailer/old_unclassified_updated.rhtml index 69f54323d..b03780016 100644 --- a/app/views/request_mailer/old_unclassified_updated.rhtml +++ b/app/views/request_mailer/old_unclassified_updated.rhtml @@ -1,9 +1,5 @@ <%= _('To help us keep the site tidy, someone else has updated the status of the -{{law_used_full}} request {{title}} -that you made to {{public_body}}, to -{{display_status}} If you disagree with -their categorisation, please update the status again yourself to what -you believe to be more accurate.',:law_used_full=>@info_request.law_used_full,:title=>@info_request.title, :public_body=>@info_request.public_body.name,:display_status=>@info_request.display_status.downcase)%> +{{law_used_full}} request {{title}} that you made to {{public_body}}, to "{{display_status}}" If you disagree with their categorisation, please update the status again yourself to what you believe to be more accurate.',:law_used_full=>@info_request.law_used_full,:title=>@info_request.title, :public_body=>@info_request.public_body.name,:display_status=>@info_request.display_status.downcase)%> <%=_ ('Follow this link to see the request:')%> diff --git a/config/general-example b/config/general-example index fd8925278..f9118acbd 100644 --- a/config/general-example +++ b/config/general-example @@ -29,6 +29,10 @@ define('OPTION_STAGING_SITE', 1); // Domain used in URLs generated by scripts (e.g. for going in some emails) define('OPTION_DOMAIN', '127.0.0.1:3000'); +// Workflow settings +define('OPTION_REPLY_LATE_AFTER_DAYS', 20); + + // Incoming email define('OPTION_INCOMING_EMAIL_DOMAIN', 'localhost'); // e.g. 'foifa.com' define('OPTION_INCOMING_EMAIL_PREFIX', ''); // e.g. 'foi+' diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index ac44cb905..200746e0d 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -903,7 +903,7 @@ describe RequestController, "sending overdue request alerts" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.body.should =~ /promptly, as normally\s+required by law/ + mail.body.should =~ /promptly, as normally/ mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email mail.body =~ /(http:\/\/.*\/c\/(.*))/ @@ -931,7 +931,7 @@ describe RequestController, "sending overdue request alerts" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.body.should =~ /promptly, as normally\s+required by law during term time/ + mail.body.should =~ /promptly, as normally/ mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email end |