diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-27 16:30:03 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-27 16:30:03 +0100 |
commit | 2b7bc36262090f8abe560f80629b13a359f282f0 (patch) | |
tree | b3ea34982b650a6fd50ff8482a18d915c76d8d39 | |
parent | 3db4f64cfcc0dc75204b4faaa0aa4a5c0725229e (diff) | |
parent | 033fa395369324188beea2469d072ee0965c8d74 (diff) |
Merge branch '2075-response-template-triggering-no-blank'
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 8 | ||||
-rw-r--r-- | t/open311/getservicerequestupdates.t | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index e052e4bd4..b4d7c6347 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -136,8 +136,8 @@ sub update_comments { # a more fine-grained status code that we use within FMS for # response templates. if ( $external_status_code ) { - $comment->set_extra_metadata(external_status_code =>$external_status_code); - $p->set_extra_metadata(external_status_code =>$external_status_code); + $comment->set_extra_metadata(external_status_code => $external_status_code); + $p->set_extra_metadata(external_status_code => $external_status_code); } $open311->add_media($request->{media_url}, $comment) @@ -162,6 +162,10 @@ sub update_comments { } } + # If nothing to show (no text, photo, or state change), don't show this update + $comment->state('hidden') unless $comment->text || $comment->photo + || ($comment->problem_state && $state ne $old_state); + $p->lastupdate( $comment->created ); $p->update; $comment->insert(); diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index dad3bb0d1..3c279d776 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -368,6 +368,7 @@ for my $test ( mark_open => 0, problem_state => 'investigating', end_state => 'investigating', + comment_state => 'hidden', }, { desc => 'open status does not re-open hidden report', @@ -401,6 +402,7 @@ for my $test ( is $c->mark_fixed, $test->{mark_fixed}, 'mark_closed correct'; is $c->problem_state, $test->{problem_state}, 'problem_state correct'; is $c->mark_open, $test->{mark_open}, 'mark_open correct'; + is $c->state, $test->{comment_state} || 'confirmed', 'comment state correct'; is $problem->state, $test->{end_state}, 'correct problem state'; $problem->comments->delete; }; |