aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-12-06 11:57:34 +0000
committerDave Arter <davea@mysociety.org>2016-12-06 12:16:22 +0000
commit102418842a833c29f855557bf4c410290b5a2020 (patch)
treed639ff3adbd2fecadfd5ac1266cccf65db093f47 /perllib/FixMyStreet/App/Controller/Admin.pm
parent7df5f6d00c34580987509a2ccb4520d2fde96866 (diff)
[Zurich] Fix 500 error when editing superusers
The Zurich::admin_type function was setting $c->stash->{body}, meaning that when trying to edit a superuser the 'fetch_contacts' function wasn't being called, causing an "Can't call method "all" on an undefined value" error as $c->stash->{live_contacts} wasn't ever being set. Fixed by changing the conditional to simply determine whether fetch_contacts needs to be called. Included a regression test that meant a small addition to the MapItZurich mock.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 3782063d5..bbdf449aa 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1377,7 +1377,7 @@ sub user_edit : Path('user_edit') : Args(1) {
}
if ( $user->from_body ) {
- unless ( $c->stash->{body} && $user->from_body->id eq $c->stash->{body}->id ) {
+ unless ( $c->stash->{live_contacts} ) {
$c->stash->{body} = $user->from_body;
$c->forward('fetch_contacts');
}