aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/Update.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-27 09:18:18 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-27 09:18:18 +0100
commitb483a17c13ba8e273949ce4ee8c8c05e66b06647 (patch)
tree3e928fa68c3edb90c0666ec52ad8c9982f9dab77 /perllib/FixMyStreet/App/Controller/Report/Update.pm
parent8deb709fa2d44bcbaba54734f7f4f4385980d8df (diff)
parent62ffebc89cc66d32a828ea1de8c850c3e950faa1 (diff)
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts: perllib/FixMyStreet/DB/Result/Comment.pm perllib/FixMyStreet/DB/Result/User.pm web/css/core.css
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm33
1 files changed, 14 insertions, 19 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 5421385fb..2d810d871 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -21,8 +21,8 @@ sub report_update : Path : Args(0) {
my ( $self, $c ) = @_;
$c->forward( '/report/load_problem_or_display_error', [ $c->req->param('id') ] )
- && $c->forward('process_user')
&& $c->forward('process_update')
+ && $c->forward('process_user')
&& $c->forward('/report/new/process_photo')
&& $c->forward('check_for_errors')
or $c->go( '/report/display', [ $c->req->param('id') ] );
@@ -90,28 +90,24 @@ Load user from the database or prepare a new one.
sub process_user : Private {
my ( $self, $c ) = @_;
- my $update_user;
- if ( $c->user ) {
-
- $update_user = $c->user->obj;
-
- } else {
+ my $update = $c->stash->{update};
- # Extract all the params to a hash to make them easier to work with
- my %params = #
- map { $_ => scalar $c->req->param($_) } #
- ( 'rznvy', 'name' );
+ $update->user( $c->user->obj ) if $c->user;
- # cleanup the email address
- my $email = $params{rznvy} ? lc $params{rznvy} : '';
- $email =~ s{\s+}{}g;
+ # Extract all the params to a hash to make them easier to work with
+ my %params = #
+ map { $_ => scalar $c->req->param($_) } #
+ ( 'rznvy', 'name' );
- $update_user = $c->model('DB::User')->find_or_new( { email => $email } );
- $update_user->name( Utils::trim_text( $params{name} ) );
+ # cleanup the email address
+ my $email = $params{rznvy} ? lc $params{rznvy} : '';
+ $email =~ s{\s+}{}g;
- }
+ $update->user( $c->model('DB::User')->find_or_new( { email => $email } ) )
+ unless $update->user;
- $c->stash->{update_user} = $update_user;
+ $update->user->name( Utils::trim_text( $params{name} ) )
+ if $params{name};
return 1;
}
@@ -146,7 +142,6 @@ sub process_update : Private {
text => $params{update},
name => $name,
problem => $c->stash->{problem},
- user => $c->stash->{update_user},
state => 'unconfirmed',
mark_fixed => $params{fixed} ? 1 : 0,
cobrand => $c->cobrand->moniker,