diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-28 17:25:03 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-28 17:25:03 +0100 |
commit | 70cbebec7bb2fd412c6a9fbfb694357401916372 (patch) | |
tree | 70b6b5954a0ab9f527dfc949e11753d988440c0b /perllib/FixMyStreet/App/Controller/Report/Update.pm | |
parent | 91e9552a11f9861d1c43a3a1315d322bae76dd00 (diff) |
Allow a problem creator to reopen a fixed report when logged in (fixes #125).
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/Update.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 71031bb0d..9400b3c87 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -65,6 +65,10 @@ sub update_problem : Private { } } + if ( $update->mark_open && $update->user->id == $problem->user->id ) { + $problem->state('confirmed'); + } + $problem->lastupdate( \'ms_current_timestamp()' ); $problem->update; @@ -141,7 +145,7 @@ sub process_update : Private { my ( $self, $c ) = @_; my %params = - map { $_ => scalar $c->req->param($_) } ( 'update', 'name', 'fixed' ); + map { $_ => scalar $c->req->param($_) } ( 'update', 'name', 'fixed', 'reopen' ); $params{update} = Utils::cleanup_text( $params{update}, { allow_multiline => 1 } ); @@ -149,6 +153,8 @@ sub process_update : Private { my $name = Utils::trim_text( $params{name} ); my $anonymous = $c->req->param('may_show_name') ? 0 : 1; + $params{reopen} = 0 unless $c->user && $c->user->id == $c->stash->{problem}->user->id; + my $update = $c->model('DB::Comment')->new( { text => $params{update}, @@ -156,6 +162,7 @@ sub process_update : Private { problem => $c->stash->{problem}, state => 'unconfirmed', mark_fixed => $params{fixed} ? 1 : 0, + mark_open => $params{reopen} ? 1 : 0, cobrand => $c->cobrand->moniker, cobrand_data => $c->cobrand->extra_update_data, lang => $c->stash->{lang_code}, |