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

Support Conduit application of most CustomField transactions in EditEngine

Summary:
Ref T9132. Give most standard custom fields reasonable Conduit support so you can use the new `application.x` endpoints to set them.

Major missing field type is dates, again.

Test Plan: Used Conduit to set various custom fields on a package.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9132

Differential Revision: https://secure.phabricator.com/D14635
This commit is contained in:
epriestley 2015-12-02 06:16:45 -08:00
parent c1ae5321d7
commit 773ecb9a44
6 changed files with 44 additions and 5 deletions

View file

@ -179,6 +179,10 @@ EOTEXT
$type->getEditType());
$value_type = $type->getValueType();
if (!strlen($value_type)) {
$value_type = '?';
}
$value_description = $type->getValueDescription();
$table = array();

View file

@ -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() {

View file

@ -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() {

View file

@ -1323,6 +1323,14 @@ abstract class PhabricatorCustomField extends Phobject {
}
public function shouldAppearInConduitTransactions() {
if ($this->proxy) {
return $this->proxy->shouldAppearInConduitDictionary();
}
return false;
}
/* -( Herald )------------------------------------------------------------- */

View file

@ -433,4 +433,8 @@ abstract class PhabricatorStandardCustomField
->setEditTypeKey($short);
}
public function shouldAppearInConduitTransactions() {
return true;
}
}

View file

@ -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;
}
}