diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 30 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Photo.pm | 2 | ||||
-rw-r--r-- | t/app/controller/alert_new.t | 2 | ||||
-rw-r--r-- | t/app/model/alert_type.t | 2 | ||||
-rw-r--r-- | templates/web/default/admin/council_contacts.html | 4 | ||||
-rw-r--r-- | templates/web/default/admin/search_users.html | 2 | ||||
-rw-r--r-- | templates/web/default/js/validation_strings.html | 20 | ||||
-rwxr-xr-x | templates/web/fixmystreet/static/privacy.html | 6 |
8 files changed, 41 insertions, 27 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index acdaf7c04..198acade6 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -483,6 +483,10 @@ sub search_reports : Path('search_reports') { $query = [ 'me.id' => int($1), ]; + } elsif ($search =~ /^area:(\d+)$/) { + $query = [ + 'me.areas' => { like => "%,$1,%" } + ]; } else { $query = [ 'me.id' => $search_n, @@ -523,6 +527,8 @@ sub search_reports : Path('search_reports') { 'problem.id' => int($1), %{ $site_restriction }, ]; + } elsif ($search =~ /^area:(\d+)$/) { + $query = []; } else { $query = [ 'me.id' => $search_n, @@ -534,18 +540,20 @@ sub search_reports : Path('search_reports') { %{ $site_restriction }, ]; } - my $updates = $c->model('DB::Comment')->search( - { - -or => $query, - }, - { - -select => [ 'me.*', qw/problem.council problem.state/ ], - prefetch => [qw/user problem/], - order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] - } - ); - $c->stash->{updates} = [ $updates->all ]; + if (@$query) { + my $updates = $c->model('DB::Comment')->search( + { + -or => $query, + }, + { + -select => [ 'me.*', qw/problem.council problem.state/ ], + prefetch => [qw/user problem/], + order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] + } + ); + $c->stash->{updates} = [ $updates->all ]; + } # Switch quoting back off. See above for explanation of this. $c->model('DB')->schema->storage->sql_maker->quote_char( '' ); diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm index c54bad238..5d5832b08 100644 --- a/perllib/FixMyStreet/App/Controller/Photo.pm +++ b/perllib/FixMyStreet/App/Controller/Photo.pm @@ -114,6 +114,7 @@ sub _shrink { $image->BlobToImage($photo); my $err = $image->Scale(geometry => "$size>"); throw Error::Simple("resize failed: $err") if "$err"; + $image->Strip(); my @blobs = $image->ImageToBlob(); undef $image; return $blobs[0]; @@ -129,6 +130,7 @@ sub _crop { throw Error::Simple("resize failed: $err") if "$err"; $err = $image->Extent( geometry => '90x60', gravity => 'Center' ); throw Error::Simple("resize failed: $err") if "$err"; + $image->Strip(); my @blobs = $image->ImageToBlob(); undef $image; return $blobs[0]; diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 5ea73625a..3a4c2ef81 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -452,7 +452,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { $count++ if $_->body =~ /The following updates have been left on this problem:/; $count++ if $_->body =~ /The following new problems have been reported to City of\s*Edinburgh Council:/; $count++ if $_->body =~ /The following nearby problems have been added:/; - $count++ if $_->body =~ / -\s+Testing, EH1 1BB/; + $count++ if $_->body =~ /\s+-\s+Testing,\s+EH1\s+1BB/; } is $count, 5, 'Five emails with the right things in them'; diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t index ab129b4e7..67ddc10aa 100644 --- a/t/app/model/alert_type.t +++ b/t/app/model/alert_type.t @@ -202,7 +202,7 @@ for my $test ( (my $title = $report->title) =~ s/ /\\s+/; my $body = $email->body; - like $body, qr#report/$report_id - $title, $pc#, 'email contains expected postcode'; + like $body, qr#report/$report_id\s+-\s+$title,\s+$pc#, 'email contains expected postcode'; }; } diff --git a/templates/web/default/admin/council_contacts.html b/templates/web/default/admin/council_contacts.html index acfec3ed4..da7223aa6 100644 --- a/templates/web/default/admin/council_contacts.html +++ b/templates/web/default/admin/council_contacts.html @@ -10,7 +10,11 @@ [% IF example_pc %] <a href="[% c.uri_for_email( '/around', { pc => example_pc } ) %]">[% tprintf( loc('Example postcode %s'), example_pc ) | html %]</a> | [% END %] +[% IF c.cobrand.moniker == 'emptyhomes' %] +<a href="[% c.uri_for( 'search_reports', search => 'area:' _ area_id ) %]">[% loc('List all reported problems' ) %]</a> +[% ELSE %] <a href="[% c.uri_for_email( '/reports/' _ area_id ) %]">[% loc('List all reported problems' ) %]</a> +[% END %] <a href="[% c.uri_for( 'council_contacts', area_id, { text => 1 } ) %]">[% loc('Text only version') %]</a> </p> diff --git a/templates/web/default/admin/search_users.html b/templates/web/default/admin/search_users.html index 98723e6ef..18c964dfe 100644 --- a/templates/web/default/admin/search_users.html +++ b/templates/web/default/admin/search_users.html @@ -18,7 +18,7 @@ [%- FOREACH user IN users %] <tr> <td>[% PROCESS value_or_nbsp value=user.name %]</td> - <td><a href="[% c.uri_for( 'search_reports', user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> + <td><a href="[% c.uri_for( 'search_reports', search => user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> <td>[% PROCESS value_or_nbsp value=user.from_council %]</td> <td>[% user.flagged ? loc('Yes') : ' ' %]</td> <td><a href="[% c.uri_for( 'user_edit', user.id ) %]">[% loc('Edit') %]</a></td> diff --git a/templates/web/default/js/validation_strings.html b/templates/web/default/js/validation_strings.html index 70a0ed41c..718d10d56 100644 --- a/templates/web/default/js/validation_strings.html +++ b/templates/web/default/js/validation_strings.html @@ -1,18 +1,18 @@ validation_strings = { - update: '[% loc('Please enter a message') %]', - title: '[% loc('Please enter a subject') %]', - detail: '[% loc('Please enter some details') %]', + update: '[% loc('Please enter a message') | replace("'", "\\'") %]', + title: '[% loc('Please enter a subject') | replace("'", "\\'") %]', + detail: '[% loc('Please enter some details') | replace("'", "\\'") %]', name: { - required: '[% loc('Please enter your name') %]', - validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') %]' + required: '[% loc('Please enter your name') | replace("'", "\\'") %]', + validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') | replace("'", "\\'") %]' }, - category: '[% loc('Please choose a category') %]', + category: '[% loc('Please choose a category') | replace("'", "\\'") %]', rznvy: { - required: '[% loc('Please enter your email') %]', - email: '[% loc('Please enter a valid email') %]' + required: '[% loc('Please enter your email') | replace("'", "\\'") %]', + email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' }, email: { - required: '[% loc('Please enter your email') %]', - email: '[% loc('Please enter a valid email') %]' + required: '[% loc('Please enter your email') | replace("'", "\\'") %]', + email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' } }; diff --git a/templates/web/fixmystreet/static/privacy.html b/templates/web/fixmystreet/static/privacy.html index 17480f68b..933afe1e5 100755 --- a/templates/web/fixmystreet/static/privacy.html +++ b/templates/web/fixmystreet/static/privacy.html @@ -3,9 +3,9 @@ <div class="sticky-sidebar"> <aside> <ul class="plain-list"> - <li><a href="#faq">Frequently Asked Questions</a></li> - <li><a href="#practical">Practical Questions</a></li> - <li><a href="#organisation">Organisation Questions</a></li> + <li><a href="/faq#faq">Frequently Asked Questions</a></li> + <li><a href="/faq#practical">Practical Questions</a></li> + <li><a href="/faq#organisation">Organisation Questions</a></li> <li><strong>Privacy and cookies</strong></li> </ul> </aside> |