diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-15 12:02:09 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-16 11:02:14 +0000 |
commit | 922976648c7acf072f85716f5257a4bfcda35599 (patch) | |
tree | f9958cb1f2815f172795c028d08095a659cfc60d /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | 455263622b27948cdcb3b7ff7dd9fddecda50f45 (diff) |
Include moderation history in report updates.
If the user has moderating permission, or a cobrand allows the viewing
of moderation history, show moderation history within the updates on a
report page.
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; |