aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cypress/cypress/integration/around_filters.js3
-rw-r--r--CHANGELOG.md3
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm7
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Moderate.pm25
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm97
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm10
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm4
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm2
-rw-r--r--perllib/FixMyStreet/TestMech.pm11
-rw-r--r--t/app/controller/moderate.t40
-rw-r--r--t/app/controller/photo.t26
-rw-r--r--t/app/controller/report_interest_count.t2
-rw-r--r--t/app/controller/report_new.t3
-rw-r--r--t/app/controller/report_new_text.t4
-rw-r--r--t/cobrand/zurich.t1
-rw-r--r--templates/web/base/report/_support.html4
-rw-r--r--templates/web/base/report/display_tools.html2
-rw-r--r--templates/web/base/report/new/form_user_loggedout_by_email.html4
-rw-r--r--templates/web/zurich/report/new/fill_in_details_form.html4
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js14
22 files changed, 139 insertions, 131 deletions
diff --git a/.cypress/cypress/integration/around_filters.js b/.cypress/cypress/integration/around_filters.js
index 3facf9e8c..d14fe34dd 100644
--- a/.cypress/cypress/integration/around_filters.js
+++ b/.cypress/cypress/integration/around_filters.js
@@ -115,7 +115,8 @@ describe('Around page filtering and push state', function() {
cy.visit('/around?lon=-2.295894&lat=51.526877&zoom=6');
// get the second image which is the pin, first is the shadow
cy.get('image[title="Lights out in tunnel"]:last').invoke('attr', 'xlink:href').should('contain', 'small');
- cy.get('image[title="Lights out in tunnel"]:last').click();
+ // force to hopefully work around apparent Cypress SVG issue
+ cy.get('image[title="Lights out in tunnel"]:last').click({force: true});
cy.wait('@show-report');
cy.contains('Back to all reports');
cy.get('image[title="Lights out in tunnel"]:last').invoke('attr', 'xlink:href').should('not.contain', 'small');
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28009a2bd..76e1e0170 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,9 +7,10 @@
- Allow cobrands to limit contact form to abuse reports only
- Front end improvements:
- Clearer relocation options while you’re reporting a problem #2238
- - Admin improvements
+ - Admin improvements:
- List number of alerts on report page #669
- viewing and managing of user alerts in admin #676
+ - Allow moderation to potentially change photos. #2291
- Bugfixes:
- Add perl 5.26/5.28 support.
- Fix subcategory issues when visiting /report/new directly #2276
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index d757cec9a..75684c773 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -2211,13 +2211,14 @@ sub check_page_allowed : Private {
sub fetch_all_bodies : Private {
my ($self, $c ) = @_;
- my @bodies = $c->cobrand->call_hook('admin_fetch_all_bodies') || do {
+ my @bodies = $c->cobrand->call_hook('admin_fetch_all_bodies');
+ if (!@bodies) {
my $bodies = $c->model('DB::Body')->search(undef, {
columns => [ "id", "name", "deleted", "parent" ],
})->with_parent_name;
$bodies = $bodies->with_defect_type_count if $c->stash->{with_defect_type_count};
- $bodies->translated->all_sorted;
- };
+ @bodies = $bodies->translated->all_sorted;
+ }
$c->stash->{bodies} = \@bodies;
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index 4b43be081..7979f31f6 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -446,7 +446,7 @@ sub generate_csv : Private {
split ',', $hashref->{areas};
}
- if ($obj->can('local_coords')) {
+ if ($obj->can('local_coords') && $asked_for{local_coords_x}) {
($hashref->{local_coords_x}, $hashref->{local_coords_y}) =
$obj->local_coords;
}
diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm
index c47c34f37..d8fc38211 100644
--- a/perllib/FixMyStreet/App/Controller/Moderate.pm
+++ b/perllib/FixMyStreet/App/Controller/Moderate.pm
@@ -69,19 +69,40 @@ sub report : Chained('moderate') : PathPart('report') : CaptureArgs(1) {
sub moderate_report : Chained('report') : PathPart('') : Args(0) {
my ($self, $c) = @_;
+ my $problem = $c->stash->{problem};
+
# Make sure user can moderate this report
- $c->detach unless $c->user->can_moderate($c->stash->{problem});
+ $c->detach unless $c->user->can_moderate($problem);
$c->forward('report_moderate_hide');
my @types = grep $_,
- ($c->user->can_moderate_title($c->stash->{problem}, 1)
+ ($c->user->can_moderate_title($problem, 1)
? $c->forward('moderate_text', [ 'title' ])
: ()),
$c->forward('moderate_text', [ 'detail' ]),
$c->forward('moderate_boolean', [ 'anonymous', 'show_name' ]),
$c->forward('moderate_boolean', [ 'photo' ]);
+ # Deal with possible photo changes. If a moderate form uses a standard
+ # photo upload field (with upload_fileid, label and file upload handlers),
+ # this will allow photos to be changed, not just switched on/off. You will
+ # probably want a hidden field with problem_photo=1 to skip that check.
+ my $photo_edit_form = defined $c->get_param('photo1');
+ if ($photo_edit_form) {
+ $c->forward('/photo/process_photo');
+ if ( my $photo_error = delete $c->stash->{photo_error} ) {
+ $c->flash->{photo_error} = $photo_error;
+ } else {
+ my $fileid = $c->stash->{upload_fileid};
+ if ($fileid ne $problem->photo) {
+ $problem->get_photoset->delete_cached;
+ $problem->update({ photo => $fileid || undef });
+ push @types, 'photo';
+ }
+ }
+ }
+
$c->detach( 'report_moderate_audit', \@types )
}
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm
index 9a2a4f470..ed890ad82 100644
--- a/perllib/FixMyStreet/App/Controller/My.pm
+++ b/perllib/FixMyStreet/App/Controller/My.pm
@@ -210,7 +210,7 @@ sub planned_change : Path('planned/change') {
$c->res->content_type('application/json; charset=utf-8');
$c->res->body(encode_json({ outcome => $add ? 'add' : 'remove' }));
} else {
- $c->res->redirect( $c->uri_for_action('report/display', $id) );
+ $c->res->redirect( $c->uri_for_action('report/display', [ $id ]) );
}
}
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 854dbf3ea..d4ff0a2ca 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -20,8 +20,8 @@ Show a report
=head2 index
-Redirect to homepage unless C<id> parameter in query, in which case redirect to
-'/report/$id'.
+Redirect to homepage unless we have a homepage template,
+in which case show that.
=cut
@@ -35,13 +35,13 @@ sub index : Path('') : Args(0) {
}
}
-=head2 report_display
+=head2 id
-Display a report.
+Load in ID, for use by chained pages.
=cut
-sub display : Path('') : Args(1) {
+sub id :PathPart('report') :Chained :CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
if (
@@ -49,15 +49,17 @@ sub display : Path('') : Args(1) {
|| $id =~ m{ ^(\d+) \D .* $ }x # trailing garbage
)
{
- return $c->res->redirect( $c->uri_for($1), 301 );
+ $c->res->redirect( $c->uri_for($1), 301 );
+ $c->detach;
}
- $c->forward( '_display', [ $id ] );
+ $c->forward( 'load_problem_or_display_error', [ $id ] );
}
=head2 ajax
-Return JSON formatted details of a report
+Return JSON formatted details of a report.
+URL used by mobile app so remains /report/ajax/N.
=cut
@@ -65,14 +67,20 @@ sub ajax : Path('ajax') : Args(1) {
my ( $self, $c, $id ) = @_;
$c->stash->{ajax} = 1;
- $c->forward( '_display', [ $id ] );
+ $c->forward('load_problem_or_display_error', [ $id ]);
+ $c->forward('display');
}
-sub _display : Private {
- my ( $self, $c, $id ) = @_;
+=head2 display
+
+Display a report.
+
+=cut
+
+sub display :PathPart('') :Chained('id') :Args(0) {
+ my ( $self, $c ) = @_;
$c->forward('/auth/get_csrf_token');
- $c->forward( 'load_problem_or_display_error', [ $id ] );
$c->forward( 'load_updates' );
$c->forward( 'format_problem_for_display' );
@@ -84,21 +92,14 @@ sub _display : Private {
}
}
-sub support : Path('support') : Args(0) {
+sub support :Chained('id') :Args(0) {
my ( $self, $c ) = @_;
- my $id = $c->get_param('id');
-
- my $uri =
- $id
- ? $c->uri_for( '/report', $id )
- : $c->uri_for('/');
-
- if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_body ) {
- $c->forward( 'load_problem_or_display_error', [ $id ] );
+ if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_body ) {
$c->stash->{problem}->update( { interest_count => \'interest_count +1' } );
}
- $c->res->redirect( $uri );
+
+ $c->res->redirect($c->stash->{problem}->url);
}
sub load_problem_or_display_error : Private {
@@ -193,7 +194,7 @@ sub load_updates : Private {
$c->stash->{updates} = \@combined;
if ($c->sessionid) {
- foreach (qw(alert_to_reporter anonymized)) {
+ foreach (qw(alert_to_reporter anonymized photo_error)) {
$c->stash->{$_} = $c->flash->{$_} if $c->flash->{$_};
}
}
@@ -206,6 +207,9 @@ sub format_problem_for_display : Private {
my $problem = $c->stash->{problem};
+ # upload_fileid is used by the update form on this page
+ $c->stash->{problem_upload_fileid} = $problem->get_photoset->data;
+
( $c->stash->{latitude}, $c->stash->{longitude} ) =
map { Utils::truncate_coordinate($_) }
( $problem->latitude, $problem->longitude );
@@ -271,22 +275,18 @@ users too about this change, at which point we can delete:
=cut
-sub delete :Local :Args(1) {
- my ( $self, $c, $id ) = @_;
+sub delete :Chained('id') :Args(0) {
+ my ($self, $c) = @_;
$c->forward('/auth/check_csrf_token');
- $c->forward( 'load_problem_or_display_error', [ $id ] );
my $p = $c->stash->{problem};
- my $uri = $c->uri_for( '/report', $id );
-
- return $c->res->redirect($uri) unless $c->user_exists;
+ return $c->res->redirect($p->url) unless $c->user_exists;
my $body = $c->user->obj->from_body;
- return $c->res->redirect($uri) unless $body;
-
- return $c->res->redirect($uri) unless $p->bodies->{$body->id};
+ return $c->res->redirect($p->url) unless $body;
+ return $c->res->redirect($p->url) unless $p->bodies->{$body->id};
$p->state('hidden');
$p->lastupdate( \'current_timestamp' );
@@ -299,26 +299,10 @@ sub delete :Local :Args(1) {
admin_user => $c->user->from_body->name,
object_type => 'problem',
action => 'state_change',
- object_id => $id,
+ object_id => $p->id,
} );
- return $c->res->redirect($uri);
-}
-
-=head2 action_router
-
-A router for dispatching handlers for sub-actions on a particular report,
-e.g. /report/1/inspect
-
-=cut
-
-sub action_router : Path('') : Args(2) {
- my ( $self, $c, $id, $action ) = @_;
-
- $c->go( 'map', [ $id ] ) if $action eq 'map';
- $c->go( 'nearby_json', [ $id ] ) if $action eq 'nearby.json';
-
- $c->detach( '/page_error_404_not_found', [] );
+ return $c->res->redirect($p->url);
}
sub inspect : Private {
@@ -539,10 +523,8 @@ sub inspect : Private {
}
};
-sub map : Private {
- my ( $self, $c, $id ) = @_;
-
- $c->forward( 'load_problem_or_display_error', [ $id ] );
+sub map :Chained('id') :Args(0) {
+ my ($self, $c) = @_;
my $image = $c->stash->{problem}->static_map;
$c->res->content_type($image->{content_type});
@@ -550,10 +532,9 @@ sub map : Private {
}
-sub nearby_json : Private {
- my ( $self, $c, $id ) = @_;
+sub nearby_json :PathPart('nearby.json') :Chained('id') :Args(0) {
+ my ($self, $c) = @_;
- $c->forward( 'load_problem_or_display_error', [ $id ] );
my $p = $c->stash->{problem};
my $dist = 1;
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index f057a31f6..1a1a657a9 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -481,6 +481,9 @@ sub initialize_report : Private {
# save the token to delete at the end
$c->stash->{partial_token} = $token if $report;
+ $c->stash->{email} = $report->user->email;
+ $c->stash->{phone} = $report->user->phone_display;
+
} else {
# no point keeping it if it is done.
$token->delete;
@@ -807,6 +810,9 @@ sub process_user : Private {
$report->user( $user );
$c->forward('update_user', [ \%params ]);
+ $c->stash->{phone} = $report->user->phone_display;
+ $c->stash->{email} = $report->user->email;
+
if ($c->stash->{contributing_as_body} or $c->stash->{contributing_as_anonymous_user}) {
$report->name($user->from_body->name);
$user->name($user->from_body->name) unless $user->name;
@@ -832,6 +838,10 @@ sub process_user : Private {
$c->forward('update_user', [ \%params ]);
+ $c->stash->{phone} = Utils::trim_text( $type eq 'phone' ? $report->user->phone_display : $params{phone} );
+ $c->stash->{email} = Utils::trim_text( $type eq 'email' ? $report->user->email : $params{email} );
+
+
# The user is trying to sign in. We only care about username from the params.
if ( $c->get_param('submit_sign_in') || $c->get_param('password_sign_in') ) {
$c->stash->{tfa_data} = {
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index cb9bbdb67..dc46be61f 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -23,14 +23,14 @@ sub report_update : Path : Args(0) {
$c->forward('initialize_update');
$c->forward('load_problem');
$c->forward('check_form_submitted')
- or $c->go( '/report/display', [ $c->stash->{problem}->id ] );
+ or $c->go( '/report/display', [ $c->stash->{problem}->id ], [] );
$c->forward('/auth/check_csrf_token');
$c->forward('process_update');
$c->forward('process_user');
$c->forward('/photo/process_photo');
$c->forward('check_for_errors')
- or $c->go( '/report/display', [ $c->stash->{problem}->id ] );
+ or $c->go( '/report/display', [ $c->stash->{problem}->id ], [] );
$c->forward('save_update');
$c->forward('redirect_or_confirm_creation');
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 7740474ab..4098c6708 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -1096,7 +1096,7 @@ sub admin_fetch_all_bodies {
my %sorted;
foreach (@bodies) {
- my $p = $_->{parent} || 0;
+ my $p = $_->{parent} ? $_->{parent}{id} : 0;
push @{$sorted{$p}}, $_;
}
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index e7fc573c0..495310063 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -706,7 +706,7 @@ sub create_problems_for_body {
latitude => '51.5016605453401',
longitude => '-0.142497580865087',
user_id => $user->id,
- photo => $mech->get_photo_data,
+ photo => '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg',
};
my %report_params = ( %$default_params, %$params );
@@ -721,15 +721,6 @@ sub create_problems_for_body {
return @problems;
}
-sub get_photo_data {
- my $mech = shift;
- return $mech->{sample_photo} ||= do {
- my $sample_file = FixMyStreet->path_to( 't/app/controller/sample.jpg' );
- $mech->builder->ok( -f "$sample_file", "sample file $sample_file exists" );
- $sample_file->slurp(iomode => '<:raw');
- };
-}
-
sub create_comment_for_problem {
my ( $mech, $problem, $user, $name, $text, $anonymous, $state, $problem_state, $params ) = @_;
$params ||= {};
diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t
index c3aba0ebb..c2b185cde 100644
--- a/t/app/controller/moderate.t
+++ b/t/app/controller/moderate.t
@@ -49,11 +49,10 @@ sub create_report {
latitude => '51.4129',
longitude => '0.007831',
user_id => $user2->id,
- photo => $mech->get_photo_data,
+ photo => '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg',
});
}
my $report = create_report();
-my $report2 = create_report();
my $REPORT_URL = '/report/' . $report->id ;
@@ -236,31 +235,22 @@ subtest 'Problem moderation' => sub {
};
$mech->content_lacks('Posted anonymously', 'sanity check');
+my ($csrf) = $mech->content =~ /meta content="([^"]*)" name="csrf-token"/;
-subtest 'Problem 2' => sub {
- my $REPORT2_URL = '/report/' . $report2->id ;
- $mech->get_ok($REPORT2_URL);
- $mech->submit_form_ok({ with_fields => {
+subtest 'Edit photos' => sub {
+ $mech->post_ok('http://www.example.org/moderate/report/' . $report->id, {
%problem_prepopulated,
- problem_title => 'Good good',
- problem_detail => 'Good good improved',
- }});
- $mech->base_like( qr{\Q$REPORT2_URL\E} );
-
- $report2->discard_changes;
- is $report2->title, 'Good good';
- is $report2->detail, 'Good good improved';
-
- $mech->submit_form_ok({ with_fields => {
+ photo1 => 'something-wrong',
+ token => $csrf,
+ });
+ $mech->post_ok('http://www.example.org/moderate/report/' . $report->id, {
%problem_prepopulated,
- problem_revert_title => 1,
- problem_revert_detail => 1,
- }});
- $mech->base_like( qr{\Q$REPORT2_URL\E} );
-
- $report2->discard_changes;
- is $report2->title, 'Good bad good';
- is $report2->detail, 'Good bad bad bad good bad';
+ photo1 => '',
+ upload_fileid => '',
+ token => $csrf,
+ });
+ $report->discard_changes;
+ is $report->photo, undef;
};
sub create_update {
@@ -268,7 +258,7 @@ sub create_update {
user => $user2,
name => 'Test User 2',
anonymous => 'f',
- photo => $mech->get_photo_data,
+ photo => '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg',
text => 'update good good bad good',
state => 'confirmed',
mark_fixed => 0,
diff --git a/t/app/controller/photo.t b/t/app/controller/photo.t
index e28ee1946..19249611a 100644
--- a/t/app/controller/photo.t
+++ b/t/app/controller/photo.t
@@ -75,7 +75,7 @@ subtest "Check multiple upload worked" => sub {
};
};
-subtest "Check photo uploading URL works" => sub {
+subtest "Check photo uploading URL and endpoints work" => sub {
my $UPLOAD_DIR = tempdir( CLEANUP => 1 );
# submit initial pc form
@@ -95,20 +95,18 @@ subtest "Check photo uploading URL works" => sub {
is $mech->content, '{"id":"74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg"}';
my $image_file = path($UPLOAD_DIR, '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
ok $image_file->exists, 'File uploaded to temp';
- };
-};
-subtest "Check photo URL endpoints work" => sub {
- my $p = FixMyStreet::DB->resultset("Problem")->first;
-
- $mech->get_ok('/photo/temp.74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
- my $image_file = FixMyStreet->path_to('web/photo/temp.74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
- ok -e $image_file, 'File uploaded to temp';
- $mech->get_ok('/photo/' . $p->id . '.jpeg');
- $image_file = FixMyStreet->path_to('web/photo/' . $p->id . '.jpeg');
- ok -e $image_file, 'File uploaded to temp';
- my $res = $mech->get('/photo/0.jpeg');
- is $res->code, 404, "got 404";
+ my $p = FixMyStreet::DB->resultset("Problem")->first;
+
+ $mech->get_ok('/photo/temp.74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
+ $image_file = FixMyStreet->path_to('web/photo/temp.74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg');
+ ok -e $image_file, 'File uploaded to temp';
+ $mech->get_ok('/photo/' . $p->id . '.jpeg');
+ $image_file = FixMyStreet->path_to('web/photo/' . $p->id . '.jpeg');
+ ok -e $image_file, 'File uploaded to temp';
+ my $res = $mech->get('/photo/0.jpeg');
+ is $res->code, 404, "got 404";
+ };
};
done_testing();
diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t
index 04f567615..330d844d0 100644
--- a/t/app/controller/report_interest_count.t
+++ b/t/app/controller/report_interest_count.t
@@ -109,7 +109,7 @@ FixMyStreet::override_config {
$mech->content_contains( '1 supporter' );
$mech->log_out_ok( $user->email );
- $mech->post_ok("/report/support", { id => $report_id } );
+ $mech->post_ok("/report/$report_id/support");
is $mech->uri->path, "/report/$report_id", 'add support redirects to report page';
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 94c7b1231..86d058287 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -680,6 +680,7 @@ subtest "test password errors for a user who is signing in as they report" => su
name => 'Joe Bloggs',
phone => '01234 567 890',
password => 'secret2',
+ phone_verified => 1,
} ), "set user details";
# submit initial pc form
@@ -715,6 +716,8 @@ subtest "test password errors for a user who is signing in as they report" => su
is_deeply $mech->page_errors, [
"There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the \x{2018}No\x{2019} section of the form.",
], "check there were errors";
+
+ $mech->content_lacks('1234', 'phone number not shown');
};
foreach my $test (
diff --git a/t/app/controller/report_new_text.t b/t/app/controller/report_new_text.t
index cb07e57ee..8b7805c31 100644
--- a/t/app/controller/report_new_text.t
+++ b/t/app/controller/report_new_text.t
@@ -222,6 +222,8 @@ subtest "test password errors for a user who is signing in as they report" => su
ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
MAPIT_URL => 'http://mapit.uk/',
SMS_AUTHENTICATION => 1,
+ phone_verified => 1,
+ email_verified => 1,
}, sub {
$mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" );
$mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
@@ -245,6 +247,8 @@ subtest "test password errors for a user who is signing in as they report" => su
is_deeply $mech->page_errors, [
"There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the \x{2018}No\x{2019} section of the form.",
], "check there were errors";
+
+ $mech->content_lacks($user->email, 'email not displayed');
};
subtest "test report creation for a user who is signing in as they report" => sub {
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 2f60231ab..45888771d 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -833,6 +833,7 @@ subtest "only superuser can see 'Add body' form" => sub {
}, sub {
$mech->get_ok( '/admin/bodies' );
};
+ $mech->content_contains('External Body');
$mech->content_lacks( '<form method="post" action="bodies"' );
$mech->log_out_ok;
};
diff --git a/templates/web/base/report/_support.html b/templates/web/base/report/_support.html
index 3e372ba69..420b632aa 100644
--- a/templates/web/base/report/_support.html
+++ b/templates/web/base/report/_support.html
@@ -8,8 +8,8 @@
%]
[% IF c.user AND c.user.from_body %]
- <form action="[% c.uri_for( '/report/support' ) %]">
- <p id="supporter"><small>[% text %] <input type="hidden" name="id" value="[% problem.id %]"><input type="submit" class="green-btn" value="Add support"></small></p>
+ <form action="/report/[% problem.id %]/support">
+ <p id="supporter"><small>[% text %] <input type="submit" class="green-btn" value="Add support"></small></p>
</form>
[% ELSE %]
<p id="supporter"><small>[% text %]</small></p>
diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html
index eaf45fdf3..be788a50d 100644
--- a/templates/web/base/report/display_tools.html
+++ b/templates/web/base/report/display_tools.html
@@ -1,7 +1,7 @@
<div class="shadow-wrap">
<ul id="key-tools">
[% IF c.user_exists AND c.cobrand.users_can_hide AND c.user.belongs_to_body( problem.bodies_str ) %]
- <li><form method="post" action="/report/delete/[% problem.id %]" id="remove-from-site-form">
+ <li><form method="post" action="/report/[% problem.id %]/delete" id="remove-from-site-form">
<input type="hidden" name="token" value="[% csrf_token %]">
<button type="submit" id="key-tool-report-abuse" class="abuse" data-confirm="[% loc('Are you sure?') %]" name="remove_from_site">[% loc('Remove from site') %]</button>
</form></li>
diff --git a/templates/web/base/report/new/form_user_loggedout_by_email.html b/templates/web/base/report/new/form_user_loggedout_by_email.html
index 7ede54cd1..73db38795 100644
--- a/templates/web/base/report/new/form_user_loggedout_by_email.html
+++ b/templates/web/base/report/new/form_user_loggedout_by_email.html
@@ -13,12 +13,12 @@
[% UNLESS c.cobrand.call_hook('disable_phone_number_entry') %]
<div id="js-hide-if-username-phone">
<label class="form-focus-hidden" for="form_phone">[% loc('Phone number (optional)') %]</label>
- <input class="form-control form-focus-hidden" type="text" value="[% report.user.phone_display | html %]" name="phone" id="form_phone">
+ <input class="form-control form-focus-hidden" type="text" value="[% phone | html %]" name="phone" id="form_phone">
</div>
[% END %]
<div id="js-hide-if-username-email">
<label class="form-focus-hidden" for="form_email">[% loc('Email address (optional)') %]</label>
- <input class="form-control form-focus-hidden" type="text" value="[% report.user.email | html %]" name="email" id="form_email">
+ <input class="form-control form-focus-hidden" type="text" value="[% email | html %]" name="email" id="form_email">
</div>
<label class="form-focus-hidden" for="password_register">[% loc('Password (optional)') %]</label>
diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html
index 6d75674c4..bd20efdaa 100644
--- a/templates/web/zurich/report/new/fill_in_details_form.html
+++ b/templates/web/zurich/report/new/fill_in_details_form.html
@@ -54,7 +54,7 @@
[% IF field_errors.username %]
<p class='form-error'>[% field_errors.username %]</p>
[% END %]
- <input class="form-control" type="email" value="[% report.user.email | html %]" name="username" id="form_username" required>
+ <input class="form-control" type="email" value="[% email | html %]" name="username" id="form_username" required>
<label for="form_name">[% loc('Name') %] [% loc('(optional)') %]</label>
[% IF field_errors.name %]
@@ -66,7 +66,7 @@
[% IF field_errors.phone %]
<p class='form-error'>[% field_errors.phone %]</p>
[% END %]
- <input class="form-control" type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone" required>
+ <input class="form-control" type="text" value="[% phone | html %]" name="phone" id="form_phone" required>
<div class="form-txt-submit-box">
[%# class of submit_sign_in so name can be optional, name of submit_register so it doesn't try and sign us in %]
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 8e5e40f4d..af69a536e 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -556,10 +556,16 @@ $.extend(fixmystreet.set_up, {
if ('Dropzone' in window) {
Dropzone.autoDiscover = false;
+ } else {
+ return;
}
- if ('Dropzone' in window && $('#form_photo', $context).length) {
- var $originalLabel = $('[for="form_photo"]', $context);
- var $originalInput = $('#form_photos', $context);
+
+ var forms = $('[for="form_photo"], .js-photo-label', $context).closest('form');
+ forms.each(function() {
+ // Internal $context is the individual form with the photo upload inside
+ var $context = $(this);
+ var $originalLabel = $('[for="form_photo"], .js-photo-label', $context);
+ var $originalInput = $('#form_photos, .js-photo-fields', $context);
var $dropzone = $('<div>').addClass('dropzone');
$originalLabel.removeAttr('for');
@@ -642,7 +648,7 @@ $.extend(fixmystreet.set_up, {
photodrop.emit("complete", mockFile);
photodrop.options.maxFiles -= 1;
});
- }
+ });
},
report_list_filters: function() {