1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Fix control state for custom application policies with template types

Summary:
Fixes T9118. When populating some policy controls like "Default Can View" for repositories, we do some special logic to add object policies which are valid for the target object type.

For example, it's OK to set the default policy for an object which has subscribers to "Subscribers".

However, this logic incorrectly //removed// custom policies, so the form input ended up blank.

Instead, provide both object policies and custom policies.

Test Plan:
  - Set default view policy to a custom policy.
  - Hit "Edit" again, saw control correctly reflect custom policy after change.
  - Set default edit policy to a different custom policy.
  - Saved, edited, verified both policies stuck.
  - Set both policies back.
  - Checked some other object types to make sure object policies still work properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9118

Differential Revision: https://secure.phabricator.com/D14310
This commit is contained in:
epriestley 2015-10-20 06:56:11 -07:00
parent bbbda23678
commit 22b9b76079

View file

@ -145,7 +145,12 @@ final class PhabricatorApplicationEditController
->setViewer($user)
->setObject($template_object)
->execute();
$control->setPolicies($template_policies);
// NOTE: We want to expose both any object template policies
// (like "Subscribers") and any custom policy.
$all_policies = $template_policies + $policies;
$control->setPolicies($all_policies);
$control->setTemplateObject($template_object);
}
}