diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-11-19 11:23:11 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-11-19 11:23:13 +0000 |
commit | 399a38c4636fac6ce4a2eb21053604ba74309a36 (patch) | |
tree | 1ce5856b2ec5600990784c0d9e315776f679f5e3 | |
parent | 37bc826c8ee49d11fd56d7ec612009b57d277582 (diff) |
[UK] Updates only by reporter on open reports conf
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 7 | ||||
-rw-r--r-- | t/cobrand/councils.t | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 401ef8c45..8ef51f328 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -291,9 +291,12 @@ sub updates_disallowed { my $staff = $c->user_exists && $c->user->from_body && $c->user->from_body->name =~ /$body/; my $superuser = $c->user_exists && $c->user->is_superuser; return 1 unless $staff || $superuser; - } elsif ($type eq 'reporter') { + } + + if ($type =~ /reporter/) { return 1 if !$c->user_exists || $c->user->id != $problem->user->id; - } elsif ($type eq 'open') { + } + if ($type =~ /open/) { return 1 if $problem->is_fixed || $problem->is_closed; } diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 81e5dd569..c652e44c2 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -391,9 +391,12 @@ sub updates_disallowed { my $staff = $c->user_exists && $c->user->from_body && $c->user->from_body->name eq $self->council_name; my $superuser = $c->user_exists && $c->user->is_superuser; return 1 unless $staff || $superuser; - } elsif ($cfg eq 'reporter') { + } + + if ($cfg =~ /reporter/) { return 1 if !$c->user_exists || $c->user->id != $problem->user->id; - } elsif ($cfg eq 'open') { + } + if ($cfg =~ /open/) { return 1 if $problem->is_fixed || $problem->is_closed; } diff --git a/t/cobrand/councils.t b/t/cobrand/councils.t index 1cd9c491e..a194a9be1 100644 --- a/t/cobrand/councils.t +++ b/t/cobrand/councils.t @@ -55,6 +55,8 @@ subtest "Test update shown/not shown appropriately" => sub { { type => 'none', update => [0,0,0] }, { type => 'staff', update => [0,0,1] }, { type => 'reporter', update => [0,1,1] }, + { type => 'reporter-open', state => 'closed', update => [0,0,0] }, + { type => 'reporter-open', state => 'in progress', update => [0,1,1] }, { type => 'open', state => 'closed', update => [0,0,0] }, { type => 'open', state => 'in progress', update => [1,1,1] }, ) { |