diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-12-03 17:59:23 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-12-04 10:08:14 +0000 |
commit | 51cbde5ebcc08c52d3d5531c529c0c7a52b5e230 (patch) | |
tree | cc49b82f9c6b7e0a9fff52444b1665912cfe39b8 /perllib | |
parent | be3c0f5917fe1de5d87442f9341b033e3007c344 (diff) |
Fix moderation without JavaScript.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 1951028c8..4e009f8d4 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -92,6 +92,29 @@ sub display :PathPart('') :Chained('id') :Args(0) { } } +sub moderate_report :PathPart('moderate') :Chained('id') :Args(0) { + my ( $self, $c ) = @_; + + if ($c->user_exists && $c->user->can_moderate($c->stash->{problem})) { + $c->stash->{show_moderation} = 'report'; + $c->stash->{template} = 'report/display.html'; + $c->detach('display'); + } + $c->res->redirect($c->stash->{problem}->url); +} + +sub moderate_update :PathPart('moderate') :Chained('id') :Args(1) { + my ( $self, $c, $update_id ) = @_; + + my $comment = $c->stash->{problem}->comments->find($update_id); + if ($c->user_exists && $comment && $c->user->can_moderate($comment)) { + $c->stash->{show_moderation} = $update_id; + $c->stash->{template} = 'report/display.html'; + $c->detach('display'); + } + $c->res->redirect($c->stash->{problem}->url); +} + sub support :Chained('id') :Args(0) { my ( $self, $c ) = @_; |