Page MenuHomePhabricator

D8299.diff
No OneTemporary

D8299.diff

Index: src/applications/differential/customfield/DifferentialCoreCustomField.php
===================================================================
--- src/applications/differential/customfield/DifferentialCoreCustomField.php
+++ src/applications/differential/customfield/DifferentialCoreCustomField.php
@@ -79,7 +79,7 @@
return true;
}
- protected function didSetObject(PhabricatorCustomFieldInterface $object) {
+ public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
if ($this->isCoreFieldRequired()) {
$this->setFieldError(true);
}
Index: src/applications/maniphest/controller/ManiphestTaskDetailController.php
===================================================================
--- src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -47,15 +47,9 @@
$field_list = PhabricatorCustomField::getObjectFields(
$task,
PhabricatorCustomField::ROLE_VIEW);
-
- foreach ($field_list->getFields() as $field) {
- $field->setObject($task);
- $field->setViewer($user);
- }
-
- $field_list->readFieldsFromStorage($task);
-
- $aux_fields = $field_list->getFields();
+ $field_list
+ ->setViewer($user)
+ ->readFieldsFromStorage($task);
$e_commit = PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT;
$e_dep_on = PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK;
Index: src/applications/maniphest/controller/ManiphestTaskEditController.php
===================================================================
--- src/applications/maniphest/controller/ManiphestTaskEditController.php
+++ src/applications/maniphest/controller/ManiphestTaskEditController.php
@@ -158,11 +158,6 @@
$task,
PhabricatorCustomField::ROLE_EDIT);
$field_list->setViewer($user);
-
- foreach ($field_list->getFields() as $field) {
- $field->setObject($task);
- }
-
$field_list->readFieldsFromStorage($task);
$aux_fields = $field_list->getFields();
@@ -389,6 +384,7 @@
if ($fields) {
id(new PhabricatorCustomFieldList($fields))
+ ->setViewer($user)
->readFieldsFromStorage($template_task);
foreach ($fields as $key => $field) {
Index: src/applications/people/customfield/PhabricatorUserBlurbField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserBlurbField.php
+++ src/applications/people/customfield/PhabricatorUserBlurbField.php
@@ -29,7 +29,7 @@
return true;
}
- protected function didSetObject(PhabricatorCustomFieldInterface $object) {
+ public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
$this->value = $object->loadUserProfile()->getBlurb();
}
Index: src/applications/people/customfield/PhabricatorUserRealNameField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserRealNameField.php
+++ src/applications/people/customfield/PhabricatorUserRealNameField.php
@@ -29,7 +29,7 @@
return true;
}
- protected function didSetObject(PhabricatorCustomFieldInterface $object) {
+ public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
$this->value = $object->getRealName();
}
Index: src/applications/people/customfield/PhabricatorUserTitleField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserTitleField.php
+++ src/applications/people/customfield/PhabricatorUserTitleField.php
@@ -29,7 +29,7 @@
return true;
}
- protected function didSetObject(PhabricatorCustomFieldInterface $object) {
+ public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
$this->value = $object->loadUserProfile()->getTitle();
}
Index: src/infrastructure/customfield/field/PhabricatorCustomField.php
===================================================================
--- src/infrastructure/customfield/field/PhabricatorCustomField.php
+++ src/infrastructure/customfield/field/PhabricatorCustomField.php
@@ -347,6 +347,7 @@
* Sets the object this field belongs to.
*
* @param PhabricatorCustomFieldInterface The object this field belongs to.
+ * @return this
* @task context
*/
final public function setObject(PhabricatorCustomFieldInterface $object) {
@@ -362,6 +363,21 @@
/**
+ * Read object data into local field storage, if applicable.
+ *
+ * @param PhabricatorCustomFieldInterface The object this field belongs to.
+ * @return this
+ * @task context
+ */
+ public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
+ if ($this->proxy) {
+ $this->proxy->readValueFromObject($object);
+ }
+ return $this;
+ }
+
+
+ /**
* Get the object this field belongs to.
*
* @return PhabricatorCustomFieldInterface The object this field belongs to.
Index: src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
===================================================================
--- src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
+++ src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
@@ -39,6 +39,11 @@
public function readFieldsFromStorage(
PhabricatorCustomFieldInterface $object) {
+ foreach ($this->fields as $field) {
+ $field->setObject($object);
+ $field->readValueFromObject($object);
+ }
+
$keys = array();
foreach ($this->fields as $field) {
if ($field->shouldEnableForRole(PhabricatorCustomField::ROLE_STORAGE)) {
Index: src/view/form/control/AphrontFormPolicyControl.php
===================================================================
--- src/view/form/control/AphrontFormPolicyControl.php
+++ src/view/form/control/AphrontFormPolicyControl.php
@@ -180,7 +180,9 @@
'customPlaceholder' => $this->getCustomPolicyPlaceholder(),
));
- $selected = $flat_options[$this->getValue()];
+ $selected = idx($flat_options, $this->getValue(), array());
+ $selected_icon = idx($selected, 'icon');
+ $selected_name = idx($selected, 'name');
return phutil_tag(
'div',
@@ -205,8 +207,8 @@
'class' => 'phui-button-text',
),
array(
- $icons[$selected['icon']],
- $selected['name'],
+ idx($icons, $selected_icon),
+ $selected_name,
)),
)),
$input,

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 3:54 PM (6 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7697262
Default Alt Text
D8299.diff (6 KB)

Event Timeline