diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Contact.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Hounslow.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/UKCouncilWMTS.pm | 2 | ||||
-rw-r--r-- | t/cobrand/bathnes.t | 15 | ||||
-rw-r--r-- | t/cobrand/bristol.t | 10 | ||||
-rw-r--r-- | t/sendreport/open311.t | 41 | ||||
-rw-r--r-- | templates/web/base/alert/_list.html | 14 | ||||
-rw-r--r-- | web/cobrands/bexley/js.js | 1 | ||||
-rw-r--r-- | web/cobrands/sass/_base.scss | 16 |
10 files changed, 96 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 456be61d1..18197b9ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Don't include lat/lon of private reports in ‘Report another problem here’ link. - Allow contact send method to be unset always. + - Fix z-index stacking bug that was causing unclickable RSS icons on /alert page. #2624 - Front end improvements: - Set report title autocomplete to off to prevent email autocompleting - Development improvements: diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index c8cd14907..06566a8ab 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -33,7 +33,6 @@ sub begin : Private { my ($self, $c) = @_; $c->forward('/begin'); $c->forward('setup_request'); - $c->forward('determine_contact_type'); } =head2 index @@ -44,6 +43,7 @@ Display contact us page sub index : Path : Args(0) { my ( $self, $c ) = @_; + $c->forward('determine_contact_type'); } =head2 submit @@ -55,6 +55,7 @@ Handle contact us form submission sub submit : Path('submit') : Args(0) { my ( $self, $c ) = @_; + $c->forward('determine_contact_type'); $c->res->redirect( '/contact' ) and return unless $c->req->method eq 'POST'; $c->go('index') unless $c->forward('validate'); diff --git a/perllib/FixMyStreet/Cobrand/Hounslow.pm b/perllib/FixMyStreet/Cobrand/Hounslow.pm index 2987c0ae3..2146f2b67 100644 --- a/perllib/FixMyStreet/Cobrand/Hounslow.pm +++ b/perllib/FixMyStreet/Cobrand/Hounslow.pm @@ -76,12 +76,14 @@ sub all_reports_single_body { { name => "Hounslow Borough Council" } } sub open311_post_send { my ($self, $row, $h) = @_; - # Check Open311 was successful - return unless $row->external_id; + # Stop the email being sent for each Open311 failure; only the once. + return if $row->get_extra_metadata('hounslow_email_sent'); my $e = join( '@', 'enquiries', $self->council_url . 'highways.org' ); my $sender = FixMyStreet::SendReport::Email->new( to => [ [ $e, 'Hounslow Highways' ] ] ); - $sender->send($row, $h); + if (!$sender->send($row, $h)) { + $row->set_extra_metadata('hounslow_email_sent', 1); + } } sub open311_config { diff --git a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm index da0720f06..aba6d3840 100644 --- a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm +++ b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm @@ -36,6 +36,8 @@ sub tile_parameters { # Reproject a WGS84 lat/lon into BNG easting/northing sub reproject_from_latlon($$$) { my ($self, $lat, $lon) = @_; + # do not try to reproject if we have no co-ordindates as convert breaks + return (0.0, 0.0) if $lat == 0 && $lon == 0; my ($x, $y) = Utils::convert_latlon_to_en($lat, $lon); return ($x, $y); } diff --git a/t/cobrand/bathnes.t b/t/cobrand/bathnes.t index 6586dcb96..1ebddd05a 100644 --- a/t/cobrand/bathnes.t +++ b/t/cobrand/bathnes.t @@ -11,7 +11,7 @@ my $counciluser = $mech->create_user_ok('counciluser@example.com', name => 'Coun my $normaluser = $mech->create_user_ok('normaluser@example.com', name => 'Normal User'); $normaluser->update({ phone => "+447123456789" }); -$mech->create_problems_for_body(1, $body->id, 'Title', { +my ($problem) = $mech->create_problems_for_body(1, $body->id, 'Title', { areas => ",2651,", category => 'Potholes', cobrand => 'fixmystreet', user => $normaluser, service => 'iOS', extra => { _fields => [ @@ -199,4 +199,17 @@ subtest 'extra CSV columns are present if permission granted' => sub { }; +subtest 'check cobrand correctly reset on each request' => sub { + FixMyStreet::override_config { + 'ALLOWED_COBRANDS' => [ 'bathnes', 'fixmystreet' ], + }, sub { + $mech->log_in_ok( $superuser->email ); + $mech->host('www.fixmystreet.com'); + $mech->get_ok( '/contact?id=' . $problem->id ); + $mech->host('bathnes.fixmystreet.com'); + $mech->get_ok( '/contact?reject=1&id=' . $problem->id ); + $mech->content_contains('Reject report'); + } +}; + done_testing(); diff --git a/t/cobrand/bristol.t b/t/cobrand/bristol.t index b2b8cff13..d4770b6ee 100644 --- a/t/cobrand/bristol.t +++ b/t/cobrand/bristol.t @@ -21,6 +21,16 @@ my $email_contact = $mech->create_contact_ok( send_method => 'Email' ); +subtest 'Reports page works with no reports', sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'bristol' ], + MAPIT_URL => 'http://mapit.uk/', + MAP_TYPE => 'Bristol', + }, sub { + $mech->get_ok("/reports"); + }; +}; + subtest 'Only Open311 categories are shown on Bristol cobrand', sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'bristol' ], diff --git a/t/sendreport/open311.t b/t/sendreport/open311.t index 382df39f0..1cec5dd68 100644 --- a/t/sendreport/open311.t +++ b/t/sendreport/open311.t @@ -155,4 +155,45 @@ subtest 'test handles bad category', sub { like $bad_category_report->send_fail_reason, qr/Category Flytipping does not exist for body/, 'failure message set'; }; +my $hounslow = $mech->create_body_ok( 2483, 'Hounslow Borough Council'); +my $contact2 = $mech->create_contact_ok( body_id => $hounslow->id, category => 'Graffiti', email => 'GRAF' ); +$contact2->set_extra_fields( + { code => 'easting', datatype => 'number' }, + { code => 'northing', datatype => 'number' }, + { code => 'fixmystreet_id', datatype => 'number' }, +); +$contact2->update; + +my ($hounslow_report) = $mech->create_problems_for_body( 1, $hounslow->id, 'Test', { + cobrand => 'hounslow', + category => 'Graffiti', + user => $user, + latitude => 51.482286, + longitude => -0.328163, + cobrand => 'hounslow', +}); + +subtest 'Hounslow sends email upon Open311 submission', sub { + $hounslow->update( { send_method => 'Open311', endpoint => 'http://endpoint.example.com', jurisdiction => 'hounslow', api_key => 'test' } ); + $mech->clear_emails_ok; + FixMyStreet::override_config { + STAGING_FLAGS => { send_reports => 1 }, + ALLOWED_COBRANDS => [ 'hounslow' ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + FixMyStreet::Script::Reports::send(); + }; + $hounslow_report->discard_changes; + ok $hounslow_report->whensent, 'Report marked as sent'; + ok $hounslow_report->get_extra_metadata('hounslow_email_sent'), "Enquiries inbox email marked as sent"; + my ($hounslow_email, $user_email) = $mech->get_email; + my $body = $mech->get_text_body_from_email($hounslow_email); + like $body, qr/A user of FixMyStreet has submitted the following report/; + like $body, qr/Category: Graffiti/; + like $body, qr/Enquiry ref: 248/; + $body = $mech->get_text_body_from_email($user_email); + like $body, qr/reference number is 248/; +}; + + done_testing(); diff --git a/templates/web/base/alert/_list.html b/templates/web/base/alert/_list.html index d997a5abb..b9d955466 100644 --- a/templates/web/base/alert/_list.html +++ b/templates/web/base/alert/_list.html @@ -23,7 +23,9 @@ [% END %] <p id="rss_local"> - <a href="[% rss_feed_uri %]"><img src='/i/feed.png' width='16' height='16' title='[% loc('RSS feed of nearby problems') %]' alt='[% loc('RSS feed') %]' border='0'></a> + <a href="[% rss_feed_uri %]" class="alerts-rss-link"> + <img src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed of nearby problems') %]" alt="[% loc('RSS feed') %]"> + </a> <label class="label-containing-checkbox" for="[% rss_feed_id %]"> <input type="radio" name="feed" id="[% rss_feed_id %]" value="[% rss_feed_id %]"[% IF rss_feed_id == selected_feed || selected_feed == '' %] checked[% END %]> [% tprintf( loc('Problems within %.1fkm of %s'), population_radius, name_of_location ) %] @@ -38,8 +40,9 @@ [% FOREACH option IN options %] <p> - <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" -title="[% option.rss_text %]" alt="RSS feed" border="0"></a> + <a href="[% option.uri %]" class="alerts-rss-link"> + <img src="/i/feed.png" width="16" height="16" title="[% option.rss_text %]" alt="[% loc('RSS feed') %]"> + </a> <label class="label-containing-checkbox" for="[% option.id %]"> <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> [% option.text %] @@ -55,8 +58,9 @@ title="[% option.rss_text %]" alt="RSS feed" border="0"></a> [% FOREACH option IN reported_to_options %] <p> - <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" - title="[% option.rss_text %]" alt="RSS feed" border="0"></a> + <a href="[% option.uri %]" class="alerts-rss-link"> + <img src="/i/feed.png" width="16" height="16" title="[% option.rss_text %]" alt="[% loc('RSS feed') %]"> + </a> <label class="label-containing-checkbox" for="[% option.id %]"> <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> [% option.text %] diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js index e0d87d66d..cc973fda6 100644 --- a/web/cobrands/bexley/js.js +++ b/web/cobrands/bexley/js.js @@ -123,6 +123,7 @@ fixmystreet.assets.add(road_defaults, { }, road: true, all_categories: true, + nearest_radius: 0.1, actions: { found: function(layer, feature) { var category = $('select#form_category').val(), diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index 32a85fa04..2d67b3986 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -2377,11 +2377,17 @@ a#geolocate_link.loading, .btn--geolocate.loading { .a { background: #f6f6f6; } - img[width="16"] { - margin-top: 4px; - margin-#{$left}: 0.5em; - float: $right; - } +} + +.alerts-rss-link { + position: relative; + z-index: 1; // stack in front of the position:relative .label-containing-checkbox + + img { + margin-top: 4px; + margin-#{$left}: 0.5em; + float: $right; + } } .alerts__nearby-activity { |