diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-23 12:23:46 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-23 12:23:46 +0100 |
commit | 81c542caf4819268bb6b3cb5c1a445f8e5a10b04 (patch) | |
tree | 5b1e7a3a3444cd9a24706d9211c2bc5707ea6f08 /perllib/FixMyStreet/App/Controller/Report/Update.pm | |
parent | 32ff76afda2411410c28b36055ba01ab7ded248d (diff) |
Use update user centrally.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 2f1d88d08..4e0d6d6c5 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -20,10 +20,6 @@ Creates an update to a report sub report_update : Path : Args(0) { my ( $self, $c ) = @_; - # if there's no id then we should just stop now - $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] ) - unless $c->req->param('id'); - $c->forward( '/report/load_problem_or_display_error', [ $c->req->param('id') ] ) && $c->forward('process_user') && $c->forward('process_update') @@ -182,7 +178,7 @@ sub check_for_errors : Private { # let the model check for errors my %field_errors = ( - %{ $c->stash->{update_user}->check_for_errors }, + %{ $c->stash->{update}->user->check_for_errors }, %{ $c->stash->{update}->check_for_errors }, ); @@ -213,14 +209,13 @@ Save the update and the user as appropriate. sub save_update : Private { my ( $self, $c ) = @_; - my $user = $c->stash->{update_user}; my $update = $c->stash->{update}; - if ( !$user->in_storage ) { - $user->insert; + if ( !$update->user->in_storage ) { + $update->user->insert; } - elsif ( $c->user && $c->user->id == $user->id ) { - $user->update; + elsif ( $c->user && $c->user->id == $update->user->id ) { + $update->user->update; $update->confirm; } |