diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 9 | ||||
-rw-r--r-- | templates/web/default/report/display.html | 7 |
2 files changed, 14 insertions, 2 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}, diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html index 8f819a431..7dcb92288 100644 --- a/templates/web/default/report/display.html +++ b/templates/web/default/report/display.html @@ -85,7 +85,12 @@ <textarea name="update" id="form_update" rows="7" cols="30">[% update.text | html %]</textarea> </div> - [% IF problem.state != 'fixed' %] + [% IF problem.state == 'fixed' AND c.user_exists AND c.user.id == problem.user_id %] + <div class="checkbox"> + <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF update.mark_open %]> + <label for="form_reopen">[% loc('This problem has not been fixed') %]</label> + </div> + [% ELSIF problem.state != 'fixed' %] <div class="checkbox"> <input type="checkbox" name="fixed" id="form_fixed" value="1"[% ' checked' IF update.mark_fixed %]> <label for="form_fixed">[% loc('This problem has been fixed') %]</label> |