diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 16 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 51 | ||||
-rw-r--r-- | templates/web/default/report/updates.html | 1 |
3 files changed, 68 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 81aa18b95..76c96e581 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -146,6 +146,22 @@ sub get_photo_params { return $photo; } +=head2 meta_problem_state + +Returns a string suitable for display in the update meta section. +Mostly removes the '- council/user' bit from fixed states + +=cut + +sub meta_problem_state { + my $self = shift; + + my $state = $self->problem_state; + $state =~ s/ -.*$//; + + return $state; +} + # we need the inline_constructor bit as we don't inherit from Moose __PACKAGE__->meta->make_immutable( inline_constructor => 0 ); diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 45e8e8c57..5d6f902e3 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -451,6 +451,54 @@ for my $state ( qw/unconfirmed hidden partial/ ) { for my $test ( { + desc => 'from authority user marks report as investigating', + fields => { + name => $user->name, + may_show_name => 1, + add_alert => 0, + photo => '', + update => 'Set state to investigating', + state => 'investigating', + }, + state => 'investigating', + }, + { + desc => 'from authority user marks report as planned', + fields => { + name => $user->name, + may_show_name => 1, + add_alert => 0, + photo => '', + update => 'Set state to planned', + state => 'planned', + }, + state => 'planned', + }, + { + desc => 'from authority user marks report as in progress', + fields => { + name => $user->name, + may_show_name => 1, + add_alert => 0, + photo => '', + update => 'Set state to in progress', + state => 'in progress', + }, + state => 'in progress', + }, + { + desc => 'from authority user marks report as closed', + fields => { + name => $user->name, + may_show_name => 1, + add_alert => 0, + photo => '', + update => 'Set state to closed', + state => 'closed', + }, + state => 'closed', + }, + { desc => 'from authority user marks report as fixed', fields => { name => $user->name, @@ -484,6 +532,9 @@ for my $test ( is $update->text, $test->{fields}->{update}, 'update text'; is $update->problem_state, $test->{state}, 'problem state set'; + my $update_meta = $mech->extract_update_metas; + like $update_meta->[0], qr/marked as $test->{fields}->{state}$/, 'update meta includes state change'; + $report->discard_changes; is $report->state, $test->{state}, 'state set'; }; diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index 910430114..95a2c7b38 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -12,6 +12,7 @@ [%- c.cobrand.extra_update_meta_text(update) -%] [%- ", " _ loc( 'marked as fixed' ) IF update.mark_fixed %] [%- ", " _ loc( 'reopened' ) IF update.mark_open %] + [%- ", " _ tprintf(loc( 'marked as %s' ), update.meta_problem_state) IF update.problem_state %] </em></p> [% IF c.cobrand.allow_update_reporting %] |