diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Alert.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm index f93231235..a42e7203a 100644 --- a/perllib/FixMyStreet/App/Controller/Alert.pm +++ b/perllib/FixMyStreet/App/Controller/Alert.pm @@ -151,7 +151,7 @@ sub updates : Path('updates') : Args(0) { $c->forward('/auth/get_csrf_token'); $c->stash->{email} = $c->get_param('rznvy'); - $c->stash->{problem_id} = $c->get_param('id'); + $c->stash->{email} ||= $c->user->email if $c->user_exists; } =head2 confirm @@ -196,7 +196,7 @@ sub create_alert : Private { $alert->insert(); } - if ( $c->user && $c->user->id == $alert->user->id ) { + if ( $c->user_exists && ($c->user->id == $alert->user->id || $c->stash->{can_create_for_another})) { $alert->confirm(); } else { $alert->confirmed(0); @@ -340,8 +340,12 @@ sub process_user : Private { my ( $self, $c ) = @_; if ( $c->user_exists ) { - $c->stash->{alert_user} = $c->user->obj; - return; + $c->stash->{can_create_for_another} = $c->stash->{problem} + && $c->user->has_permission_to(contribute_as_another_user => $c->stash->{problem}->bodies_str_ids); + if (!$c->stash->{can_create_for_another}) { + $c->stash->{alert_user} = $c->user->obj; + return; + } } my $email = $c->get_param('rznvy'); diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index debf27cde..9cc810c16 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -91,6 +91,10 @@ sub display :PathPart('') :Chained('id') :Args(0) { $c->stash->{template} = 'report/inspect.html'; $c->forward('inspect'); } + + if ($c->user_exists && $c->user->has_permission_to(contribute_as_another_user => $c->stash->{problem}->bodies_str_ids)) { + $c->stash->{email} = $c->user->email; + } } sub moderate_report :PathPart('moderate') :Chained('id') :Args(0) { |