@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

When a field isn't lockable, just freeze the lock status instead of removing any lock

Summary:
See downstream issue here: <https://phabricator.wikimedia.org/T150992>

In at least one case (project milestones) we have a locked, non-lockable field. This means "this is locked, and you can't change the fact that it is locked".

At least for now, preserve this behavior.

Test Plan: Created a new milestone of an existing project. This worked correctly with the patch.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D16895

+9 -8
+9 -8
src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
··· 144 144 switch (idx($locks, $key)) { 145 145 case self::LOCK_LOCKED: 146 146 $field->setIsHidden(false); 147 - $field->setIsLocked(true); 147 + if ($field->getIsLockable()) { 148 + $field->setIsLocked(true); 149 + } 148 150 break; 149 151 case self::LOCK_HIDDEN: 150 152 $field->setIsHidden(true); 151 - $field->setIsLocked(false); 153 + if ($field->getIsLockable()) { 154 + $field->setIsLocked(false); 155 + } 152 156 break; 153 157 case self::LOCK_VISIBLE: 154 158 $field->setIsHidden(false); 155 - $field->setIsLocked(false); 159 + if ($field->getIsLockable()) { 160 + $field->setIsLocked(false); 161 + } 156 162 break; 157 163 default: 158 164 // If we don't have an explicit value, don't make any adjustments. 159 165 break; 160 - } 161 - 162 - // If the field isn't lockable, remove any lock we applied. 163 - if (!$field->getIsLockable()) { 164 - $field->setIsLocked(false); 165 166 } 166 167 } 167 168