@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Let "<select />" EditEngine fields canonicalize saved defaults

Summary:
Ref T12124. After D18134 we accept either "25" or "low" via HTTP parameters and when the field renders as a control, but if the form has a default value for the field but locks or hides it we don't actually run through that logic.

Canonicalize both when rendering the control and when using a raw saved default value.

Test Plan:
- Created a form with "Priority: Low".
- Hid the "Priority" field.
- Before patch: Tried to create a task, was rebuffed with a (now verbose and helpful, after D18135) error.
- Applied patch: things worked.

Reviewers: chad, amckinley

Reviewed By: amckinley

Maniphest Tasks: T12124

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

+17 -10
+17 -10
src/applications/transactions/editfield/PhabricatorSelectEditField.php
··· 27 27 return $this->optionAliases; 28 28 } 29 29 30 + protected function getDefaultValueFromConfiguration($value) { 31 + return $this->getCanonicalValue($value); 32 + } 33 + 30 34 protected function getValueForControl() { 31 35 $value = parent::getValueForControl(); 32 - 33 - $options = $this->getOptions(); 34 - if (!isset($options[$value])) { 35 - $aliases = $this->getOptionAliases(); 36 - if (isset($aliases[$value])) { 37 - $value = $aliases[$value]; 38 - } 39 - } 40 - 41 - return $value; 36 + return $this->getCanonicalValue($value); 42 37 } 43 38 44 39 protected function newControl() { ··· 57 52 58 53 protected function newConduitParameterType() { 59 54 return new ConduitStringParameterType(); 55 + } 56 + 57 + private function getCanonicalValue($value) { 58 + $options = $this->getOptions(); 59 + if (!isset($options[$value])) { 60 + $aliases = $this->getOptionAliases(); 61 + if (isset($aliases[$value])) { 62 + $value = $aliases[$value]; 63 + } 64 + } 65 + 66 + return $value; 60 67 } 61 68 62 69 }