diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-04-17 16:46:13 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-04-17 16:46:15 +0100 |
commit | 8c29dac37c39ceb88c4ae56353e123b80b77839e (patch) | |
tree | 7b37247ed1f5c5e1e4351b0ce4100f4a5a03c2ce | |
parent | 524b44db045789941e0248f599c409d968a759e7 (diff) |
Switch round staff/superuser staff-category check.
If it checks the body first, then a superuser who is also assigned to a
body would not be able to see staff categories in a different body.
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Contact.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Contact.pm b/perllib/FixMyStreet/DB/ResultSet/Contact.pm index f8f182e05..801d20cc0 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Contact.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Contact.pm @@ -36,7 +36,10 @@ sub for_new_reports { $rs->me('body_id') => [ keys %$bodies ], }; - if ($c->user_exists && $c->user->from_body) { + if ($c->user_exists && $c->user->is_superuser) { + # Everything normal OR any staff states + $params->{$rs->me('state')} = [ 'unconfirmed', 'confirmed', 'staff' ]; + } elsif ($c->user_exists && $c->user->from_body) { # Everything normal OR staff state in the user body $params->{'-or'} = [ $rs->me('state') => [ 'unconfirmed', 'confirmed' ], @@ -45,9 +48,6 @@ sub for_new_reports { $rs->me('state') => 'staff', }, ]; - } elsif ($c->user_exists && $c->user->is_superuser) { - # Everything normal OR any staff states - $params->{$rs->me('state')} = [ 'unconfirmed', 'confirmed', 'staff' ]; } else { $params->{$rs->me('state')} = [ 'unconfirmed', 'confirmed' ]; } |