diff options
-rw-r--r-- | .travis.yml | 4 | ||||
-rwxr-xr-x | bin/install-as-user | 3 | ||||
m--------- | commonlib | 0 | ||||
l--------- | conf/packages | 2 | ||||
-rw-r--r-- | conf/packages.debian-wheezy | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/AlertType.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 5 | ||||
-rw-r--r-- | t/app/model/alert_type.t | 25 | ||||
-rw-r--r-- | t/app/model/problem.t | 4 | ||||
-rw-r--r-- | t/i18n.t | 13 |
10 files changed, 39 insertions, 21 deletions
diff --git a/.travis.yml b/.travis.yml index 9ce5dbc86..ac971bbfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,6 @@ language: perl perl: - "5.14" -branches: - only: - - master - before_install: - sudo apt-get update -qq - sudo apt-get install -qq jhead libgmp-dev diff --git a/bin/install-as-user b/bin/install-as-user index a7a3be9dc..b05616702 100755 --- a/bin/install-as-user +++ b/bin/install-as-user @@ -88,7 +88,8 @@ export PATH="\$GEM_HOME/bin:\$PATH" EOBRC fi -gem install --no-ri --no-rdoc compass +gem install --conservative --no-ri --no-rdoc sass -v 3.2.14 +gem install --conservative --no-ri --no-rdoc compass -v 0.12.2 # Use compass to generate the CSS, if it doesn't seem to already # exist: diff --git a/commonlib b/commonlib -Subproject 9582d37bc63e51581d90fdee59bafedd5863f09 +Subproject 4e67698fa8d8b25b71b1baaf1a1856dcd566e5a diff --git a/conf/packages b/conf/packages index b5287718b..123595395 120000 --- a/conf/packages +++ b/conf/packages @@ -1 +1 @@ -packages.debian-squeeze+testing
\ No newline at end of file +packages.debian-wheezy
\ No newline at end of file diff --git a/conf/packages.debian-wheezy b/conf/packages.debian-wheezy index d93a2eceb..68c824ac9 100644 --- a/conf/packages.debian-wheezy +++ b/conf/packages.debian-wheezy @@ -9,7 +9,6 @@ perlmagick libmath-bigint-gmp-perl gettext ruby-compass -postgresql-9.1 postgresql-server-dev-9.1 gnuplot ttf-bitstream-vera diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm index a2784950a..cc4fc67fc 100644 --- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm +++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm @@ -58,6 +58,7 @@ sub email_alerts ($) { while (my $row = $query->fetchrow_hashref) { my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->{alert_cobrand})->new(); + $cobrand->set_lang_and_domain( $row->{alert_lang}, 1, FixMyStreet->path_to('locale')->stringify ); # Cobranded and non-cobranded messages can share a database. In this case, the conf file # should specify a vhost to send the reports for each cobrand, so that they don't get sent @@ -204,7 +205,7 @@ sub _send_aggregated_alert_email(%) { my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($data{cobrand})->new(); - $cobrand->set_lang_and_domain( $data{lang}, 1 ); + $cobrand->set_lang_and_domain( $data{lang}, 1, FixMyStreet->path_to('locale')->stringify ); if (!$data{alert_email}) { my $user = FixMyStreet::App->model('DB::User')->find( { diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 3bf41035e..5499af474 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -340,7 +340,10 @@ sub send_reports { # XXX Only copes with at most one missing body my ($bodies, $missing) = $row->bodies_str =~ /^([\d,]+)(?:\|(\d+))?/; my @bodies = split(/,/, $bodies); - $bodies = FixMyStreet::App->model("DB::Body")->search({ id => \@bodies }); + $bodies = FixMyStreet::App->model("DB::Body")->search( + { id => \@bodies }, + { order_by => 'name' }, + ); $missing = FixMyStreet::App->model("DB::Body")->find($missing) if $missing; my @dear; diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t index ac8013278..ae413978f 100644 --- a/t/app/model/alert_type.t +++ b/t/app/model/alert_type.t @@ -487,6 +487,31 @@ subtest "check local alerts from cobrand send main site url for alerts for diffe like $body, qr#$expected2#, 'cobrand area report point to cobrand url'; }; +# Test that email alerts are sent in the right language. +subtest "correct i18n-ed summary for state of closed" => sub { + $mech->clear_emails_ok; + + $report->update( { state => 'closed' } ); + $alert->update( { lang => 'nb', cobrand => 'fiksgatami' } ); + + FixMyStreet::App->model('DB::AlertSent')->search( { + alert_id => $alert->id, + parameter => $comment->id, + } )->delete; + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fiksgatami' ], + }, sub { + FixMyStreet::App->model('DB::AlertType')->email_alerts(); + }; + + $mech->email_count_is( 1 ); + my $email = $mech->get_email; + my $body = $email->body; + my $msg = 'Denne rapporten er for tiden markert som lukket'; + like $body, qr/$msg/, 'email says problem is closed, in Norwegian'; +}; + END { $mech->delete_user($user) if $user; $mech->delete_user($user2) if $user2; diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 7303eedac..fa8cf89ae 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -465,8 +465,8 @@ foreach my $test ( { desc => 'email to two tier council', unset_whendef => 1, email_count => 1, - to => qr'Gloucestershire County Council.*Cheltenham Borough Council', - dear => qr'Dear Gloucestershire County Council and Cheltenham Borough', + to => qr'Cheltenham Borough Council.*Gloucestershire County Council', + dear => qr'Dear Cheltenham Borough Council and Gloucestershire County', body => '2226,2326', multiple => 1, }, { @@ -3,15 +3,12 @@ use warnings; use Test::More; -use FixMyStreet; -use mySociety::Locale; -use Encode; -use Data::Dumper; use HTTP::Headers; use Sort::Key qw(keysort); use POSIX 'strcoll'; -local $Data::Dumper::Sortkeys = 1; -use utf8; + +use FixMyStreet; +use mySociety::Locale; # check that the mo files have been generated die "You need to run 'commonlib/bin/gettext-makemo --quiet FixMyStreet' " @@ -59,10 +56,6 @@ my @EN_sorted = qw( A Å Ø Z ); my @NO_sorted = qw( A Z Ø Å ); my @default_sorted = qw( A Z Å Ø ); -sub utf8_diag { - diag encode_utf8( Dumper(@_) ); -} - { mySociety::Locale::negotiate_language( # |