aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/Update.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-06-23 13:33:02 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-06-23 13:33:02 +0100
commitead78ff31d49cfeff2503f9faf793e0e53110cf6 (patch)
tree8b844d48a0d8d11353c17857975ffbf8dc3067e1 /perllib/FixMyStreet/App/Controller/Report/Update.pm
parent98e23f576f1114d42f4b847e8bb57d090b19d633 (diff)
Remove unneeded defaults checking and simplify.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm18
1 files changed, 3 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 4e0d6d6c5..ccdfa8a54 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -77,14 +77,6 @@ sub update_problem : Private {
return 1;
}
-sub display_confirmation : Private {
- my ( $self, $c ) = @_;
-
- $c->stash->{template} = 'tokens/confirm_update.html';
-
- return 1;
-}
-
=head2 process_user
Load user from the database or prepare a new one.
@@ -106,13 +98,10 @@ sub process_user : Private {
$email =~ s{\s+}{}g;
my $update_user = $c->model('DB::User')->find_or_new( { email => $email } );
-
- # set the user's name if they don't have one
$update_user->name( Utils::trim_text( $params{name} ) )
- unless $update_user->name;
+ if $params{name};
$c->stash->{update_user} = $update_user;
- $c->stash->{email} = $update_user->email;
return 1;
}
@@ -158,9 +147,7 @@ sub process_update : Private {
);
$c->stash->{update} = $update;
- $c->stash->{update_text} = $update->text;
$c->stash->{add_alert} = $c->req->param('add_alert');
- $c->stash->{may_show_name} = ' checked' if $c->req->param('may_show_name');
return 1;
}
@@ -215,6 +202,7 @@ sub save_update : Private {
$update->user->insert;
}
elsif ( $c->user && $c->user->id == $update->user->id ) {
+ # Logged in and same user, so can confirm update straight away
$update->user->update;
$update->confirm;
}
@@ -250,8 +238,8 @@ sub redirect_or_confirm_creation : Private {
# If confirmed send the user straight there.
if ( $update->confirmed ) {
- $c->forward( 'signup_for_alerts' );
$c->forward( 'update_problem' );
+ $c->forward( 'signup_for_alerts' );
my $report_uri = $c->uri_for( '/report', $update->problem_id );
$c->res->redirect($report_uri);
$c->detach;