diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-24 12:34:42 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-24 12:34:42 +0100 |
commit | cc8b152ee383e8b596926e3f2cab39557b353bcc (patch) | |
tree | 776bc8c296d1af57f2d481166b4166c441d4cd1d /perllib/FixMyStreet/App/Controller/Report/Update.pm | |
parent | edf59d8605000c4363ce4d79f270559c522bc63e (diff) |
Don't show email field on reporting if logged in.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 33 |
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 d84fda1bf..d586035bc 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') ] ); @@ -86,28 +86,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; } @@ -142,7 +138,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, |