diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php b/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php index dff4d1b62f..8c7fafdc2a 100644 --- a/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php @@ -179,6 +179,10 @@ EOTEXT $type->getEditType()); $value_type = $type->getValueType(); + if (!strlen($value_type)) { + $value_type = '?'; + } + $value_description = $type->getValueDescription(); $table = array(); diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php index 3aba613e87..e585853a13 100644 --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php @@ -36,8 +36,15 @@ final class PhabricatorCustomFieldEditField } protected function newEditType() { - return id(new PhabricatorCustomFieldEditType()) + $type = id(new PhabricatorCustomFieldEditType()) ->setCustomField($this->getCustomField()); + + $http_type = $this->getHTTPParameterType(); + if ($http_type) { + $type->setValueType($http_type->getTypeName()); + } + + return $type; } public function getValueForTransaction() { @@ -65,8 +72,13 @@ final class PhabricatorCustomFieldEditField } public function getConduitEditTypes() { - // TODO: For now, don't support custom fields over Conduit. - return array(); + $field = $this->getCustomField(); + + if (!$field->shouldAppearInConduitTransactions()) { + return array(); + } + + return parent::getConduitEditTypes(); } protected function newHTTPParameterType() { diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditType.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditType.php index 034f939254..a247f50d9b 100644 --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditType.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditType.php @@ -4,6 +4,7 @@ final class PhabricatorCustomFieldEditType extends PhabricatorEditType { private $customField; + private $valueType; public function setCustomField(PhabricatorCustomField $custom_field) { $this->customField = $custom_field; @@ -14,9 +15,13 @@ final class PhabricatorCustomFieldEditType return $this->customField; } + public function setValueType($value_type) { + $this->valueType = $value_type; + return $this; + } + public function getValueType() { - // TODO: Improve. - return 'custom'; + return $this->valueType; } public function getMetadata() { diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php index 18082c8fce..f3bf787e72 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -1323,6 +1323,14 @@ abstract class PhabricatorCustomField extends Phobject { } + public function shouldAppearInConduitTransactions() { + if ($this->proxy) { + return $this->proxy->shouldAppearInConduitDictionary(); + } + return false; + } + + /* -( Herald )------------------------------------------------------------- */ diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php index 66f85bd04d..1e081f5cfe 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php @@ -433,4 +433,8 @@ abstract class PhabricatorStandardCustomField ->setEditTypeKey($short); } + public function shouldAppearInConduitTransactions() { + return true; + } + } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php index c5b86bb097..eb6ea96bf4 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php @@ -191,4 +191,10 @@ final class PhabricatorStandardCustomFieldDate } } + public function shouldAppearInConduitTransactions() { + // TODO: Dates are complicated and we don't yet support handling them from + // Conduit. + return false; + } + }