diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index a6da0d2d1df..6f0be9084df 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1846,9 +1846,11 @@ has been confirmed or email them a token if it has not been. =cut sub redirect_or_confirm_creation : Private { - my ( $self, $c ) = @_; + my ( $self, $c, $no_redirect ) = @_; my $report = $c->stash->{report}; + $no_redirect //= 0; + # If confirmed send the user straight there. if ( $report->confirmed ) { # Subscribe problem reporter to email updates @@ -1872,9 +1874,11 @@ sub redirect_or_confirm_creation : Private { $c->log->info($report->user->id . ' was logged in, redirecting to confirmation page for ' . $report->id); $c->stash->{created_report} = 'loggedin'; $c->stash->{template} = 'tokens/confirm_problem.html'; - my $redirect = $c->uri_for_action( '/report/confirmation', [ $report->id ] ); - $redirect .= "?created_report=loggedin&template=confirm_problem"; - return $c->res->redirect($redirect); + unless ($no_redirect) { + my $redirect = $c->uri_for_action( '/report/confirmation', [ $report->id ] ); + $redirect .= "?created_report=loggedin&template=confirm_problem"; + return $c->res->redirect($redirect); + } } return 1; } @@ -1897,8 +1901,10 @@ sub redirect_or_confirm_creation : Private { # tell user that they've been sent an email $c->stash->{template} = 'email_sent.html'; $c->stash->{email_type} = 'problem'; - $redirect = $c->uri_for_action( '/report/confirmation', [ $report->id ] ); - $redirect .= "?template=email_sent"; + unless ($no_redirect) { + $redirect = $c->uri_for_action( '/report/confirmation', [ $report->id ] ); + $redirect .= "?template=email_sent"; + } } elsif ($report->user->phone_verified) { $c->forward( 'send_problem_confirm_text' ); $thing = 'text'; diff --git a/perllib/FixMyStreet/App/Controller/Waste.pm b/perllib/FixMyStreet/App/Controller/Waste.pm index 99fc58f2b43..6156591828e 100644 --- a/perllib/FixMyStreet/App/Controller/Waste.pm +++ b/perllib/FixMyStreet/App/Controller/Waste.pm @@ -1723,7 +1723,7 @@ sub add_report : Private { $report->confirm; $report->update; } - $c->forward('/report/new/redirect_or_confirm_creation'); + $c->forward('/report/new/redirect_or_confirm_creation', [ 1 ]); } $c->user->update({ name => $original_name }) if $original_name;