diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-04-24 17:35:50 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-05-11 12:43:23 +0100 |
commit | 37306b9f6f4cb9b58c5e4a7bdc12e90dff879481 (patch) | |
tree | 529f8548364cd9f6707dd8b941678588661fa503 /perllib/FixMyStreet/App/Controller/Admin | |
parent | 725d7ccf1874e3404c6fa05b8269cb57bb2b2ea1 (diff) |
Disable rename on unprotected Open311 categories.
If you rename an Open311 category when it is not protected, it will only
get reinstated/deleted by the Open311 populate script shortly after, and
can cause issues due to the problem category renaming that occurs.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Bodies.pm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm index bfa74ad4e..3b99d7e0f 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm @@ -241,10 +241,14 @@ sub update_contact : Private { if ($current_contact && $contact->id && $contact->id != $current_contact->id) { $errors{category} = _('You cannot rename a category to an existing category'); } elsif ($current_contact && !$contact->id) { - # Changed name $contact = $current_contact; - $c->model('DB::Problem')->to_body($c->stash->{body_id})->search({ category => $current_category })->update({ category => $category }); - $contact->category($category); + # Set the flag here so we can run the editable test on it + $contact->set_extra_metadata(open311_protect => $c->get_param('open311_protect')); + if (!$contact->category_uneditable) { + # Changed name + $c->model('DB::Problem')->to_body($c->stash->{body_id})->search({ category => $current_category })->update({ category => $category }); + $contact->category($category); + } } my $email = $c->get_param('email'); |