diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 2 | ||||
-rw-r--r-- | t/cobrand/bromley.t | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 859484a4a..4b4363ee3 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -326,6 +326,8 @@ sub add_admin_subcategories { my $c = $self->{c}; my $user = $c->stash->{user}; + return unless $user; # e.g. admin templates, not user + my @subcategories = @{$user->get_extra_metadata('subcategories') || []}; my %active_contacts = map { $_ => 1 } @subcategories; diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t index 71180cd3e..6a7a60811 100644 --- a/t/cobrand/bromley.t +++ b/t/cobrand/bromley.t @@ -220,6 +220,7 @@ subtest 'check special subcategories in admin' => sub { ALLOWED_COBRANDS => 'bromley', MAPIT_URL => 'http://mapit.uk/', }, sub { + $mech->get_ok('/admin/templates/' . $body->id . '/new'); $mech->get_ok('/admin/users/' . $user->id); $mech->submit_form_ok({ with_fields => { 'contacts['.$contact->id.']' => 1, 'contacts[BLUE]' => 1 } }); }; |