diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-27 14:50:22 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-27 15:50:58 +0100 |
commit | 033fa395369324188beea2469d072ee0965c8d74 (patch) | |
tree | 86b16c9dbd3bf2c552a4dc77e9a46255f50fff04 /perllib | |
parent | 86677908feec287449467b565f63fa2f8db7e560 (diff) |
[Open311] Hide fetched update if no data to show.
If no text, photo, or state change, hide the update from display.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 8 |
1 files changed, 6 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(); |