diff options
-rw-r--r-- | .cypress/cypress/integration/regressions.js | 9 | ||||
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | bin/fixmystreet.com/fixture | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 27 | ||||
-rwxr-xr-x | templates/web/base/around/_updates.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/display_tools.html | 2 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 10 |
9 files changed, 40 insertions, 30 deletions
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js new file mode 100644 index 000000000..a0d5b3fc9 --- /dev/null +++ b/.cypress/cypress/integration/regressions.js @@ -0,0 +1,9 @@ +describe('Regression tests', function() { + it('Shows the sub-map links after clicking Try again', function() { + cy.viewport(480, 800); + cy.visit('/around?pc=BS10+5EE&js=1'); + cy.get('#map_box').click(200, 200); + cy.get('#try_again').click(); + cy.get('#sub_map_links').should('be.visible'); + }); +}); diff --git a/CHANGELOG.md b/CHANGELOG.md index c2df3cbbf..ef127d3b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Fix text layout issues in /reports/…/summary dashboard charts. - Fix post-edit issues on admin report edit page. - Truncate dates in Open311 output to the second. #2023 + - Fix check for visible sub map links after 'Try again'. - Admin improvements: - Inspectors can set non_public status of reports. #1992 - Default start date is shown on the dashboard. diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture index 1aa85564f..091fcab9d 100755 --- a/bin/fixmystreet.com/fixture +++ b/bin/fixmystreet.com/fixture @@ -16,6 +16,7 @@ BEGIN { } use List::Util qw(shuffle); +use Path::Tiny; use FixMyStreet; use FixMyStreet::Cobrand; use FixMyStreet::DB::Factories; diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index 7cdf150aa..866deb98e 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -360,21 +360,16 @@ sub generate_csv : Private { my $fixed_states = FixMyStreet::DB::Result::Problem->fixed_states; my $closed_states = FixMyStreet::DB::Result::Problem->closed_states; - my $wards = 0; - my $comments = 0; - foreach (@{$c->stash->{csv}->{columns}}) { - $wards = 1 if $_ eq 'wards'; - $comments = 1 if $_ eq 'acknowledged'; - } + my %asked_for = map { $_ => 1 } @{$c->stash->{csv}->{columns}}; my $problems = $c->stash->{csv}->{problems}; while ( my $report = $problems->next ) { - my $hashref = $report->as_hashref($c); + my $hashref = $report->as_hashref($c, \%asked_for); $hashref->{user_name_display} = $report->anonymous ? '(anonymous)' : $report->user->name; - if ($comments) { + if ($asked_for{acknowledged}) { for my $comment ($report->comments) { my $problem_state = $comment->problem_state or next; next unless $comment->state eq 'confirmed'; @@ -389,7 +384,7 @@ sub generate_csv : Private { } } - if ($wards) { + if ($asked_for{wards}) { $hashref->{wards} = join ', ', map { $c->stash->{children}->{$_}->{name} } grep {$c->stash->{children}->{$_} } diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index c8af63987..453300cd5 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -1172,11 +1172,12 @@ sub admin_stats { sub export_as_csv { my ($self, $c, $params) = @_; + $c->model('DB')->schema->storage->sql_maker->quote_char('"'); my $csv = $c->stash->{csv} = { problems => $c->model('DB::Problem')->search_rs( $params, { - join => 'admin_log_entries', + join => ['admin_log_entries', 'user'], distinct => 1, columns => [ 'id', 'created', @@ -1190,6 +1191,7 @@ sub export_as_csv { 'service', 'extra', { sum_time_spent => { sum => 'admin_log_entries.time_spent' } }, + 'name', 'user.id', 'user.email', 'user.phone', 'user.name', ] } ), @@ -1258,6 +1260,7 @@ sub export_as_csv { filename => 'stats', }; $c->forward('/dashboard/generate_csv'); + $c->model('DB')->schema->storage->sql_maker->quote_char(''); } sub problem_confirm_email_extras { diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 2deeb3084..fac0fc7ef 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -653,7 +653,8 @@ sub body { my $body; if ($problem->external_body) { if ($problem->cobrand eq 'zurich') { - $body = $c->model('DB::Body')->find({ id => $problem->external_body }); + my $cache = $problem->result_source->schema->cache; + return $cache->{bodies}{$problem->external_body} //= $c->model('DB::Body')->find({ id => $problem->external_body }); } else { $body = $problem->external_body; } @@ -918,12 +919,11 @@ sub add_send_method { } sub as_hashref { - my $self = shift; - my $c = shift; + my ($self, $c, $cols) = @_; my $state_t = FixMyStreet::DB->resultset("State")->display($self->state); - return { + my $out = { id => $self->id, title => $self->title, category => $self->category, @@ -935,16 +935,17 @@ sub as_hashref { state => $self->state, state_t => $state_t, used_map => $self->used_map, - is_fixed => $self->fixed_states->{ $self->state } ? 1 : 0, - photos => [ map { $_->{url} } @{$self->photos} ], - meta => $self->confirmed ? $self->meta_line( $c ) : '', - ($self->confirmed ? ( - confirmed => $self->confirmed, - confirmed_pp => $c->cobrand->prettify_dt( $self->confirmed ), - ) : ()), - created => $self->created, - created_pp => $c->cobrand->prettify_dt( $self->created ), + created => $self->created, }; + $out->{is_fixed} = $self->fixed_states->{ $self->state } ? 1 : 0 if !$cols || $cols->{is_fixed}; + $out->{photos} = [ map { $_->{url} } @{$self->photos} ] if !$cols || $cols->{photos}; + $out->{meta} = $self->confirmed ? $self->meta_line( $c ) : '' if !$cols || $cols->{meta}; + $out->{created_pp} = $c->cobrand->prettify_dt( $self->created ) if !$cols || $cols->{created_pp}; + if ($self->confirmed) { + $out->{confirmed} = $self->confirmed if !$cols || $cols->{confirmed}; + $out->{confirmed_pp} = $c->cobrand->prettify_dt( $self->confirmed ) if !$cols || $cols->{confirmed_pp}; + } + return $out; } =head2 latest_moderation_log_entry diff --git a/templates/web/base/around/_updates.html b/templates/web/base/around/_updates.html index 6121b218b..e5af69da0 100755 --- a/templates/web/base/around/_updates.html +++ b/templates/web/base/around/_updates.html @@ -1,5 +1,5 @@ <div class="shadow-wrap"> <ul id="key-tools"> - <li><a class="feed" id="key-tool-around-updates" href="[% email_url | html %]">[% loc("Get updates") %]</a></li> + <li><a class="feed js-feed" id="key-tool-around-updates" href="[% email_url | html %]">[% loc("Get updates") %]</a></li> </ul> </div> diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html index bb76cc388..8ed86c228 100644 --- a/templates/web/base/report/display_tools.html +++ b/templates/web/base/report/display_tools.html @@ -11,7 +11,7 @@ %]</a></li> [% END %] [% IF c.cobrand.moniker != 'zurich' %] - <li><a rel="nofollow" id="key-tool-report-updates" class="feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> + <li><a rel="nofollow" id="key-tool-report-updates" class="feed js-feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> [% END %] [% IF c.cobrand.moniker == 'fixmystreet' %] <li><a rel="nofollow" id="key-tool-report-share" class="share" href="#report-share">[% loc('Share') %]</a></li> diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index d85a5cdbc..c187c218c 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -682,11 +682,11 @@ $.extend(fixmystreet.set_up, { } if ($('.mobile').length) { - $('#map_permalink').hide(); + $('#map_permalink').addClass('hidden'); // Make sure we end up with one Get updates link - if ($('#key-tools a.feed').length) { - $('#sub_map_links a.feed').remove(); - $('#key-tools a.feed').appendTo('#sub_map_links'); + if ($('#key-tools a.js-feed').length) { + $('#sub_map_links a.js-feed').remove(); + $('#key-tools a.js-feed').appendTo('#sub_map_links'); } $('#key-tools li:empty').remove(); $('#report-updates-data').insertAfter($('#map_box')); @@ -696,7 +696,7 @@ $.extend(fixmystreet.set_up, { } // Show/hide depending on whether it has any children to show - if ($('#sub_map_links a:visible').length) { + if ($('#sub_map_links a').not('.hidden').length) { $('#sub_map_links').show(); } else { $('#sub_map_links').hide(); |