aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-02-19 15:47:37 +0000
committerMatthew Somerville <matthew@mysociety.org>2015-02-19 18:25:50 +0000
commitee386f44aeebe7814f258b3ba4a756e903c89719 (patch)
tree397fee3f5eb57b1768de3ae592c98275bf65bbf1 /perllib/FixMyStreet/App/Controller
parent6f997f16abba3b649d939f35abd7607076424fa9 (diff)
Always show confirmation page for reports/updates.
Rather than redirecting to the report if they're already logged in. Fixes #1003.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm1
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm21
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm7
-rw-r--r--perllib/FixMyStreet/App/Controller/Tokens.pm3
5 files changed, 8 insertions, 27 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
index 70edcabe3..e75bb05ab 100755
--- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm
+++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
@@ -106,6 +106,7 @@ sub submit_creator_fixed : Private {
}
my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem_id} } );
+ $c->stash->{problem} = $problem;
# you should not be able to answer questionnaires about problems
# that you've not submitted
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index e188a085d..817e2a631 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -168,9 +168,6 @@ sub format_problem_for_display : Private {
}
$c->stash->{extra_name_info} = $problem->bodies_str && $problem->bodies_str eq '2482' ? 1 : 0;
- if ( $c->sessionid && $c->flash->{created_report} ) {
- $c->stash->{created_report} = $c->flash->{created_report};
- }
$c->forward('generate_map_tags');
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index ebc5cc6a0..5021d90e0 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1132,23 +1132,10 @@ sub redirect_or_confirm_creation : Private {
if ( $report->confirmed ) {
# Subscribe problem reporter to email updates
$c->forward( 'create_reporter_alert' );
- my $report_uri;
-
- if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_body && $c->stash->{external_source_id}) {
- $report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } );
- } elsif ( $c->cobrand->never_confirm_reports && $report->non_public ) {
- $c->log->info( 'cobrand was set to always confirm reports and report was non public, success page showed');
- $c->stash->{template} = 'report_created.html';
- return 1;
- } else {
- $report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url;
- }
- $c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id);
- if ( $c->sessionid ) {
- $c->flash->{created_report} = 'loggedin';
- }
- $c->res->redirect($report_uri);
- $c->detach;
+ $c->log->info($report->user->id . ' was logged in, showing confirmation page for ' . $report->id);
+ $c->stash->{created_report} = 'loggedin';
+ $c->stash->{template} = 'tokens/confirm_problem.html';
+ return 1;
}
# otherwise create a confirm token and email it to them.
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index b97420238..f1a1aa821 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -376,11 +376,8 @@ sub redirect_or_confirm_creation : Private {
if ( $update->confirmed ) {
$c->forward( 'update_problem' );
$c->forward( 'signup_for_alerts' );
-
- my $report_uri = $c->cobrand->base_url_for_report( $update->problem ) . $update->problem->url;
- $c->flash->{comment_created} = 1;
- $c->res->redirect($report_uri);
- $c->detach;
+ $c->stash->{template} = 'tokens/confirm_update.html';
+ return 1;
}
# otherwise create a confirm token and email it to them.
diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm
index 44cb2429d..00ac63599 100644
--- a/perllib/FixMyStreet/App/Controller/Tokens.pm
+++ b/perllib/FixMyStreet/App/Controller/Tokens.pm
@@ -37,7 +37,7 @@ sub confirm_problem : Path('/P') {
# Look at all problems, not just cobrand, in case am approving something we don't actually show
my $problem = $c->model('DB::Problem')->find( { id => $problem_id } )
|| $c->detach('token_error');
- $c->stash->{problem} = $problem;
+ $c->stash->{report} = $problem;
if ( $problem->state eq 'unconfirmed' && $auth_token->created < DateTime->now->subtract( months => 1 ) ) {
$c->stash->{template} = 'errors/generic.html';
@@ -83,7 +83,6 @@ sub confirm_problem : Path('/P') {
) if $problem->state eq 'unconfirmed';
# Subscribe problem reporter to email updates
- $c->stash->{report} = $c->stash->{problem};
$c->forward( '/report/new/create_reporter_alert' );
# log the problem creation user in to the site