diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-16 11:09:35 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-16 11:09:35 +0000 |
commit | 7ee6a869233e90c54ecce1863389bb5e5cb65b36 (patch) | |
tree | e06dd297f23d91d5ef3bb5a8f127e7ce8b1faeb0 /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | 53624a3800db9500ad35900466aa44ad55e57c23 (diff) | |
parent | 922976648c7acf072f85716f5257a4bfcda35599 (diff) |
Merge branch 'moderation-in-front-end-updates'
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 58ce64af6..3078a4a2e 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -233,6 +233,24 @@ sub load_updates : Private { next if $questionnaires_with_updates{$q->id}; push @combined, [ $q->whenanswered, $q ]; } + + # And include moderation changes... + my $problem = $c->stash->{problem}; + my $public_history = $c->cobrand->call_hook(public_moderation_history => $problem); + my $user_can_moderate = $c->user_exists && $c->user->can_moderate($problem); + if ($public_history || $user_can_moderate) { + my @history = $problem->moderation_history; + my $last_history = $problem; + foreach my $history (@history) { + push @combined, [ $history->created, { + type => 'moderation', + last => $last_history, + entry => $history, + } ]; + $last_history = $history; + } + } + @combined = map { $_->[1] } sort { $a->[0] <=> $b->[0] } @combined; $c->stash->{updates} = \@combined; |