diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d05be748..5b84100bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Fix photo orientation in modern browsers. - Improve compatibility with G Suite OpenID Connect authentication. #3032 - Fix duplicate asset message after dismissing duplicate suggestions. + - Improve moderation diff display in a few small ways. #3105 - Admin improvements: - Display user name/email for contributed as reports. #2990 - Interface for enabling anonymous reports for certain categories. #2989 diff --git a/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm b/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm index b9abb4e40..dd76a52c0 100644 --- a/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm +++ b/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm @@ -156,6 +156,20 @@ sub compare_photo { return FixMyStreet::Template::SafeString->new($s); } +# This is a list of extra keys that could be set on a report after a moderation +# has occurred. This can confuse the display of the last moderation entry, as +# the comparison with the problem's extra will be wrong. +my @keys_to_ignore = ( + 'sent_to', # SendReport::Email adds this arrayref when sent + 'closed_updates', # Marked to close a report to updates + 'closure_alert_sent_at', # Set by alert sending if update closes a report + # Can be set/changed by an Open311 update + 'external_status_code', 'customer_reference', + # Can be set by inspectors + 'traffic_information', 'detailed_information', 'duplicates', 'duplicate_of', 'order', +); +my %keys_to_ignore = map { $_ => 1 } @keys_to_ignore; + sub compare_extra { my ($self, $other) = @_; @@ -163,7 +177,7 @@ sub compare_extra { my $new = $other->get_extra_metadata; my $both = { %$old, %$new }; - my @all_keys = grep { $_ ne 'sent_to' } sort keys %$both; + my @all_keys = grep { !$keys_to_ignore{$_} } sort keys %$both; my @s; foreach (@all_keys) { $old->{$_} = join(', ', @{$old->{$_}}) if ref $old->{$_} eq 'ARRAY'; |