Skip to content

Commit

Permalink
Add 'open-not-in-progress' updates allowed setting.
Browse files Browse the repository at this point in the history
Allows updates on open reports that aren't in progress.
For https://mysocietysupport.freshdesk.com/a/tickets/4990.
  • Loading branch information
neprune committed Jan 21, 2025
1 parent 497f348 commit 9aa0143
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions perllib/FixMyStreet/Cobrand/UK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ sub _updates_disallowed_check {
my $staff = $body_user || $superuser;
my $reporter = $c->user_exists && $c->user->id == $problem->user->id;
my $open = !($problem->is_fixed || $problem->is_closed);
my $in_progress = $problem->is_in_progress;

Check warning on line 469 in perllib/FixMyStreet/Cobrand/UK.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/UK.pm#L469

Added line #L469 was not covered by tests
my $body_comment_user = $self->body && $self->body->comment_user_id && $problem->user_id == $self->body->comment_user_id;

if ($cfg eq 'none') {
Expand All @@ -475,6 +476,8 @@ sub _updates_disallowed_check {
return $cfg unless $staff;
} elsif ($cfg eq 'open') {
return $cfg unless $open;
} elsif ($cfg eq 'open-not-in-progress') {
return $cfg unless $open && !$in_progress;
} elsif ($cfg eq 'reporter') {
return $cfg unless $reporter;
} elsif ($cfg eq 'reporter-open') {
Expand Down
2 changes: 2 additions & 0 deletions t/cobrand/councils.t
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ subtest "Test update shown/not shown appropriately" => sub {
{ type => 'reporter/staff-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] },
{ type => 'open-not-in-progress', state => 'in progress', update => [0,0,0] },
{ type => 'open-not-in-progress', update => [1,1,1] },
) {
FixMyStreet::override_config {
ALLOWED_COBRANDS => $cobrand,
Expand Down

0 comments on commit 9aa0143

Please sign in to comment.