mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Improve Conduit type handling for *.edit
endpoints
Summary: Ref T9964. Three goals here: - Make it easier to supply Conduit documentation. - Make automatic documentation for `*.edit` endpoints more complete, particularly for custom fields. - Allow type resolution via Conduit types, so you can pass `["alincoln"]` to "subscribers" instead of needing to use PHIDs. Test Plan: - Viewed and used all search and edit endpoints, including custom fields. - Used parameter type resolution to set subscribers to user "dog" instead of "PHID-USER-whatever". - Viewed HTTP parameter documentation. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9964 Differential Revision: https://secure.phabricator.com/D14796
This commit is contained in:
parent
1d72c97fc9
commit
161ebad56d
41 changed files with 510 additions and 191 deletions
|
@ -238,6 +238,7 @@ phutil_register_library_map(array(
|
|||
'ConduitMethodDoesNotExistException' => 'applications/conduit/protocol/exception/ConduitMethodDoesNotExistException.php',
|
||||
'ConduitMethodNotFoundException' => 'applications/conduit/protocol/exception/ConduitMethodNotFoundException.php',
|
||||
'ConduitPHIDListParameterType' => 'applications/conduit/parametertype/ConduitPHIDListParameterType.php',
|
||||
'ConduitPHIDParameterType' => 'applications/conduit/parametertype/ConduitPHIDParameterType.php',
|
||||
'ConduitParameterType' => 'applications/conduit/parametertype/ConduitParameterType.php',
|
||||
'ConduitPingConduitAPIMethod' => 'applications/conduit/method/ConduitPingConduitAPIMethod.php',
|
||||
'ConduitProjectListParameterType' => 'applications/conduit/parametertype/ConduitProjectListParameterType.php',
|
||||
|
@ -248,6 +249,7 @@ phutil_register_library_map(array(
|
|||
'ConduitStringParameterType' => 'applications/conduit/parametertype/ConduitStringParameterType.php',
|
||||
'ConduitTokenGarbageCollector' => 'applications/conduit/garbagecollector/ConduitTokenGarbageCollector.php',
|
||||
'ConduitUserListParameterType' => 'applications/conduit/parametertype/ConduitUserListParameterType.php',
|
||||
'ConduitWildParameterType' => 'applications/conduit/parametertype/ConduitWildParameterType.php',
|
||||
'ConpherenceColumnViewController' => 'applications/conpherence/controller/ConpherenceColumnViewController.php',
|
||||
'ConpherenceConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceConduitAPIMethod.php',
|
||||
'ConpherenceConfigOptions' => 'applications/conpherence/config/ConpherenceConfigOptions.php',
|
||||
|
@ -4103,6 +4105,7 @@ phutil_register_library_map(array(
|
|||
'ConduitMethodDoesNotExistException' => 'ConduitMethodNotFoundException',
|
||||
'ConduitMethodNotFoundException' => 'ConduitException',
|
||||
'ConduitPHIDListParameterType' => 'ConduitListParameterType',
|
||||
'ConduitPHIDParameterType' => 'ConduitListParameterType',
|
||||
'ConduitParameterType' => 'Phobject',
|
||||
'ConduitPingConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ConduitProjectListParameterType' => 'ConduitListParameterType',
|
||||
|
@ -4113,6 +4116,7 @@ phutil_register_library_map(array(
|
|||
'ConduitStringParameterType' => 'ConduitListParameterType',
|
||||
'ConduitTokenGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||
'ConduitUserListParameterType' => 'ConduitListParameterType',
|
||||
'ConduitWildParameterType' => 'ConduitListParameterType',
|
||||
'ConpherenceColumnViewController' => 'ConpherenceController',
|
||||
'ConpherenceConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ConpherenceConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
final class ConduitPHIDParameterType
|
||||
extends ConduitListParameterType {
|
||||
|
||||
protected function getParameterValue(array $request, $key) {
|
||||
$value = parent::getParameterValue($request, $key);
|
||||
|
||||
if (!is_string($value)) {
|
||||
$this->raiseValidationException(
|
||||
$request,
|
||||
$key,
|
||||
pht('Expected PHID, got something else.'));
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getParameterTypeName() {
|
||||
return 'phid';
|
||||
}
|
||||
|
||||
protected function getParameterFormatDescriptions() {
|
||||
return array(
|
||||
pht('A PHID.'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getParameterExamples() {
|
||||
return array(
|
||||
'"PHID-WXYZ-1111222233334444"',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
final class ConduitWildParameterType
|
||||
extends ConduitListParameterType {
|
||||
|
||||
protected function getParameterTypeName() {
|
||||
return 'wild';
|
||||
}
|
||||
|
||||
protected function getParameterFormatDescriptions() {
|
||||
return array(
|
||||
pht('Any mixed or complex value. Check the documentation for details.'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getParameterExamples() {
|
||||
return array(
|
||||
pht('(Wildcard)'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -76,6 +76,8 @@ final class ManiphestEditEngine
|
|||
->setKey('parent')
|
||||
->setLabel(pht('Parent Task'))
|
||||
->setDescription(pht('Task to make this a subtask of.'))
|
||||
->setConduitDescription(pht('Create as a subtask of another task.'))
|
||||
->setConduitTypeDescription(pht('PHID of the parent task.'))
|
||||
->setAliases(array('parentPHID'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_PARENT)
|
||||
->setHandleParameterType(new ManiphestTaskListHTTPParameterType())
|
||||
|
@ -87,6 +89,8 @@ final class ManiphestEditEngine
|
|||
->setKey('column')
|
||||
->setLabel(pht('Column'))
|
||||
->setDescription(pht('Workboard column to create this task into.'))
|
||||
->setConduitDescription(pht('Create into a workboard column.'))
|
||||
->setConduitTypeDescription(pht('PHID of workboard column.'))
|
||||
->setAliases(array('columnPHID'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_COLUMN)
|
||||
->setSingleValue(null)
|
||||
|
@ -98,6 +102,8 @@ final class ManiphestEditEngine
|
|||
->setKey('title')
|
||||
->setLabel(pht('Title'))
|
||||
->setDescription(pht('Name of the task.'))
|
||||
->setConduitDescription(pht('Rename the task.'))
|
||||
->setConduitTypeDescription(pht('New task name.'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_TITLE)
|
||||
->setIsRequired(true)
|
||||
->setValue($object->getTitle()),
|
||||
|
@ -106,6 +112,9 @@ final class ManiphestEditEngine
|
|||
->setAliases(array('ownerPHID', 'assign', 'assigned'))
|
||||
->setLabel(pht('Assigned To'))
|
||||
->setDescription(pht('User who is responsible for the task.'))
|
||||
->setConduitDescription(pht('Reassign the task.'))
|
||||
->setConduitTypeDescription(
|
||||
pht('New task owner, or `null` to unassign.'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_OWNER)
|
||||
->setIsCopyable(true)
|
||||
->setSingleValue($object->getOwnerPHID())
|
||||
|
@ -115,6 +124,8 @@ final class ManiphestEditEngine
|
|||
->setKey('status')
|
||||
->setLabel(pht('Status'))
|
||||
->setDescription(pht('Status of the task.'))
|
||||
->setConduitDescription(pht('Change the task status.'))
|
||||
->setConduitTypeDescription(pht('New task status constant.'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_STATUS)
|
||||
->setIsCopyable(true)
|
||||
->setValue($object->getStatus())
|
||||
|
@ -125,6 +136,8 @@ final class ManiphestEditEngine
|
|||
->setKey('priority')
|
||||
->setLabel(pht('Priority'))
|
||||
->setDescription(pht('Priority of the task.'))
|
||||
->setConduitDescription(pht('Change the priority of the task.'))
|
||||
->setConduitTypeDescription(pht('New task priority constant.'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
|
||||
->setIsCopyable(true)
|
||||
->setValue($object->getPriority())
|
||||
|
@ -134,6 +147,8 @@ final class ManiphestEditEngine
|
|||
->setKey('description')
|
||||
->setLabel(pht('Description'))
|
||||
->setDescription(pht('Task description.'))
|
||||
->setConduitDescription(pht('Update the task description.'))
|
||||
->setConduitTypeDescription(pht('New task description.'))
|
||||
->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION)
|
||||
->setValue($object->getDescription()),
|
||||
);
|
||||
|
|
|
@ -122,9 +122,12 @@ EOTEXT
|
|||
id(new PhabricatorConduitEditField())
|
||||
->setKey('paths.set')
|
||||
->setLabel(pht('Paths'))
|
||||
->setDescription(pht('Set paths for this package.'))
|
||||
->setIsConduitOnly(true)
|
||||
->setTransactionType(PhabricatorOwnersPackageTransaction::TYPE_PATHS)
|
||||
->setConduitDescription(
|
||||
pht('Overwrite existing package paths with new paths.'))
|
||||
->setConduitTypeDescription(
|
||||
pht('List of dictionaries, each describing a path.'))
|
||||
->setConduitDocumentation($paths_help),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -59,38 +59,46 @@ final class PhabricatorPasteEditEngine
|
|||
id(new PhabricatorTextEditField())
|
||||
->setKey('title')
|
||||
->setLabel(pht('Title'))
|
||||
->setDescription(pht('Name of the paste.'))
|
||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_TITLE)
|
||||
->setDescription(pht('The title of the paste.'))
|
||||
->setConduitDescription(pht('Retitle the paste.'))
|
||||
->setConduitTypeDescription(pht('New paste title.'))
|
||||
->setValue($object->getTitle()),
|
||||
id(new PhabricatorSelectEditField())
|
||||
->setKey('language')
|
||||
->setLabel(pht('Language'))
|
||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_LANGUAGE)
|
||||
->setAliases(array('lang'))
|
||||
->setIsCopyable(true)
|
||||
->setOptions($langs)
|
||||
->setDescription(
|
||||
pht(
|
||||
'Programming language to interpret the paste as for syntax '.
|
||||
'highlighting. By default, the language is inferred from the '.
|
||||
'title.'))
|
||||
->setAliases(array('lang'))
|
||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_LANGUAGE)
|
||||
->setIsCopyable(true)
|
||||
->setValue($object->getLanguage())
|
||||
->setOptions($langs),
|
||||
'Language used for syntax highlighting. By default, inferred '.
|
||||
'from the title.'))
|
||||
->setConduitDescription(
|
||||
pht('Change language used for syntax highlighting.'))
|
||||
->setConduitTypeDescription(pht('New highlighting language.'))
|
||||
->setValue($object->getLanguage()),
|
||||
id(new PhabricatorTextAreaEditField())
|
||||
->setKey('text')
|
||||
->setLabel(pht('Text'))
|
||||
->setDescription(pht('The main body text of the paste.'))
|
||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_CONTENT)
|
||||
->setMonospaced(true)
|
||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||
->setDescription(pht('The main body text of the paste.'))
|
||||
->setConduitDescription(pht('Change the paste content.'))
|
||||
->setConduitTypeDescription(pht('New body content.'))
|
||||
->setValue($object->getRawContent()),
|
||||
id(new PhabricatorSelectEditField())
|
||||
->setKey('status')
|
||||
->setLabel(pht('Status'))
|
||||
->setDescription(pht('Active or archive the paste.'))
|
||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_STATUS)
|
||||
->setIsConduitOnly(true)
|
||||
->setValue($object->getStatus())
|
||||
->setOptions(PhabricatorPaste::getStatusNameMap()),
|
||||
->setOptions(PhabricatorPaste::getStatusNameMap())
|
||||
->setDescription(pht('Active or archived status.'))
|
||||
->setConduitDescription(pht('Active or archive the paste.'))
|
||||
->setConduitTypeDescription(pht('New paste status constant.'))
|
||||
->setValue($object->getStatus()),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,13 +81,14 @@ final class PhabricatorPolicyEditEngineExtension
|
|||
$policy_field = id(new PhabricatorPolicyEditField())
|
||||
->setKey($key)
|
||||
->setLabel($label)
|
||||
->setDescription($description)
|
||||
->setAliases($aliases)
|
||||
->setIsCopyable(true)
|
||||
->setCapability($capability)
|
||||
->setPolicies($policies)
|
||||
->setTransactionType($type)
|
||||
->setEditTypeKey($edit)
|
||||
->setConduitDescription($description)
|
||||
->setConduitTypeDescription(pht('New policy PHID or constant.'))
|
||||
->setValue($object->getPolicy($capability));
|
||||
$fields[] = $policy_field;
|
||||
|
||||
|
@ -99,12 +100,14 @@ final class PhabricatorPolicyEditEngineExtension
|
|||
->setKey('spacePHID')
|
||||
->setLabel(pht('Space'))
|
||||
->setEditTypeKey('space')
|
||||
->setDescription(
|
||||
pht('Shifts the object in the Spaces application.'))
|
||||
->setIsCopyable(true)
|
||||
->setIsReorderable(false)
|
||||
->setAliases(array('space', 'policy.space'))
|
||||
->setTransactionType($type_space)
|
||||
->setDescription(pht('Select a space for the object.'))
|
||||
->setConduitDescription(
|
||||
pht('Shift the object between spaces.'))
|
||||
->setConduitTypeDescription(pht('New space PHID.'))
|
||||
->setValue($object->getSpacePHID());
|
||||
$fields[] = $space_field;
|
||||
|
||||
|
|
|
@ -46,19 +46,27 @@ final class PhabricatorProjectsEditEngineExtension
|
|||
->setKey('projectPHIDs')
|
||||
->setLabel(pht('Projects'))
|
||||
->setEditTypeKey('projects')
|
||||
->setDescription(pht('Add or remove associated projects.'))
|
||||
->setAliases(array('project', 'projects'))
|
||||
->setIsCopyable(true)
|
||||
->setUseEdgeTransactions(true)
|
||||
->setEdgeTransactionDescriptions(
|
||||
pht('Add projects.'),
|
||||
pht('Remove projects.'),
|
||||
pht('Set associated projects, overwriting current value.'))
|
||||
->setCommentActionLabel(pht('Change Projects'))
|
||||
->setDescription(pht('Select projects for the object.'))
|
||||
->setTransactionType($edge_type)
|
||||
->setMetadataValue('edge:type', $project_edge_type)
|
||||
->setValue($project_phids);
|
||||
|
||||
$projects_field->setViewer($engine->getViewer());
|
||||
|
||||
$edit_add = $projects_field->getConduitEditType('projects.add')
|
||||
->setConduitDescription(pht('Add projects.'));
|
||||
|
||||
$edit_set = $projects_field->getConduitEditType('projects.set')
|
||||
->setConduitDescription(
|
||||
pht('Set projects, overwriting current value.'));
|
||||
|
||||
$edit_rem = $projects_field->getConduitEditType('projects.remove')
|
||||
->setConduitDescription(pht('Remove projects.'));
|
||||
|
||||
return array(
|
||||
$projects_field,
|
||||
);
|
||||
|
|
|
@ -41,18 +41,25 @@ final class PhabricatorSubscriptionsEditEngineExtension
|
|||
->setKey('subscriberPHIDs')
|
||||
->setLabel(pht('Subscribers'))
|
||||
->setEditTypeKey('subscribers')
|
||||
->setDescription(pht('Manage subscribers.'))
|
||||
->setAliases(array('subscriber', 'subscribers'))
|
||||
->setIsCopyable(true)
|
||||
->setUseEdgeTransactions(true)
|
||||
->setEdgeTransactionDescriptions(
|
||||
pht('Add subscribers.'),
|
||||
pht('Remove subscribers.'),
|
||||
pht('Set subscribers, overwriting current value.'))
|
||||
->setCommentActionLabel(pht('Change Subscribers'))
|
||||
->setTransactionType($subscribers_type)
|
||||
->setValue($sub_phids);
|
||||
|
||||
$subscribers_field->setViewer($engine->getViewer());
|
||||
|
||||
$edit_add = $subscribers_field->getConduitEditType('subscribers.add')
|
||||
->setConduitDescription(pht('Add subscribers.'));
|
||||
|
||||
$edit_set = $subscribers_field->getConduitEditType('subscribers.set')
|
||||
->setConduitDescription(
|
||||
pht('Set subscribers, overwriting current value.'));
|
||||
|
||||
$edit_rem = $subscribers_field->getConduitEditType('subscribers.remove')
|
||||
->setConduitDescription(pht('Remove subscribers.'));
|
||||
|
||||
return array(
|
||||
$subscribers_field,
|
||||
);
|
||||
|
|
|
@ -64,6 +64,10 @@ abstract class PhabricatorEditEngine
|
|||
abstract public function getEngineApplicationClass();
|
||||
abstract protected function buildCustomEditFields($object);
|
||||
|
||||
protected function didBuildCustomEditFields($object, array $fields) {
|
||||
return;
|
||||
}
|
||||
|
||||
public function getFieldsForConfig(
|
||||
PhabricatorEditEngineConfiguration $config) {
|
||||
|
||||
|
@ -82,6 +86,15 @@ abstract class PhabricatorEditEngine
|
|||
|
||||
$fields = $this->buildCustomEditFields($object);
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$field
|
||||
->setViewer($viewer)
|
||||
->setObject($object);
|
||||
}
|
||||
|
||||
$fields = mpull($fields, null, 'getKey');
|
||||
$this->didBuildCustomEditFields($object, $fields);
|
||||
|
||||
$extensions = PhabricatorEditEngineExtension::getAllEnabledExtensions();
|
||||
foreach ($extensions as $extension) {
|
||||
$extension->setViewer($viewer);
|
||||
|
@ -96,19 +109,22 @@ abstract class PhabricatorEditEngine
|
|||
assert_instances_of($extension_fields, 'PhabricatorEditField');
|
||||
|
||||
foreach ($extension_fields as $field) {
|
||||
$fields[] = $field;
|
||||
$field
|
||||
->setViewer($viewer)
|
||||
->setObject($object);
|
||||
}
|
||||
|
||||
$extension_fields = mpull($extension_fields, null, 'getKey');
|
||||
$extension->didBuildCustomEditFields($this, $object, $extension_fields);
|
||||
|
||||
foreach ($extension_fields as $key => $field) {
|
||||
$fields[$key] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
$config = $this->getEditEngineConfiguration();
|
||||
$fields = $config->applyConfigurationToFields($this, $object, $fields);
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$field
|
||||
->setViewer($viewer)
|
||||
->setObject($object);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
@ -1595,6 +1611,11 @@ abstract class PhabricatorEditEngine
|
|||
foreach ($xactions as $xaction) {
|
||||
$type = $types[$xaction['type']];
|
||||
|
||||
// Let the parameter type interpret the value. This allows you to
|
||||
// use usernames in list<user> fields, for example.
|
||||
$parameter_type = $type->getConduitParameterType();
|
||||
$xaction['value'] = $parameter_type->getValue($xaction, 'value');
|
||||
|
||||
$type_xactions = $type->generateTransactions(
|
||||
clone $template,
|
||||
$xaction);
|
||||
|
|
|
@ -146,17 +146,16 @@ EOTEXT
|
|||
);
|
||||
|
||||
$key = pht('Key');
|
||||
$summary = pht('Summary');
|
||||
$description = pht('Description');
|
||||
$head_type = pht('Type');
|
||||
|
||||
$table = array();
|
||||
$table[] = "| {$key} | {$summary} |";
|
||||
$table[] = "| {$key} | {$description} |";
|
||||
$table[] = '|--------|----------------|';
|
||||
foreach ($types as $type) {
|
||||
$edit_type = $type->getEditType();
|
||||
$edit_summary = $type->getSummary();
|
||||
$table[] = "| `{$edit_type}` | {$edit_summary} |";
|
||||
$edit_description = $type->getConduitDescription();
|
||||
$table[] = "| `{$edit_type}` | {$edit_description} |";
|
||||
}
|
||||
|
||||
$out[] = implode("\n", $table);
|
||||
|
@ -166,7 +165,7 @@ EOTEXT
|
|||
$section[] = pht('Edit Type: %s', $type->getEditType());
|
||||
$section[] = '---------';
|
||||
$section[] = null;
|
||||
$section[] = $type->getDescription();
|
||||
$section[] = $type->getConduitDescription();
|
||||
$section[] = null;
|
||||
$section[] = pht(
|
||||
'This edit generates transactions of type `%s` internally.',
|
||||
|
@ -183,12 +182,8 @@ EOTEXT
|
|||
'Use `%s` to select this edit type.',
|
||||
$type->getEditType());
|
||||
|
||||
$value_type = $type->getValueType();
|
||||
if (!strlen($value_type)) {
|
||||
$value_type = '?';
|
||||
}
|
||||
|
||||
$value_description = $type->getValueDescription();
|
||||
$value_type = $type->getConduitType();
|
||||
$value_description = $type->getConduitTypeDescription();
|
||||
|
||||
$table = array();
|
||||
$table[] = "| {$key} | {$head_type} | {$description} |";
|
||||
|
|
|
@ -41,13 +41,15 @@ final class PhabricatorCommentEditEngineExtension
|
|||
$comment_field = id(new PhabricatorCommentEditField())
|
||||
->setKey('comment')
|
||||
->setLabel(pht('Comments'))
|
||||
->setDescription(pht('Add comments.'))
|
||||
->setAliases(array('comments'))
|
||||
->setIsHidden(true)
|
||||
->setIsReorderable(false)
|
||||
->setIsDefaultable(false)
|
||||
->setIsLockable(false)
|
||||
->setTransactionType($comment_type)
|
||||
->setConduitDescription(pht('Make comments.'))
|
||||
->setConduitTypeDescription(
|
||||
pht('Comment to add, formatted as remarkup.'))
|
||||
->setValue(null);
|
||||
|
||||
return array(
|
||||
|
|
|
@ -32,6 +32,13 @@ abstract class PhabricatorEditEngineExtension extends Phobject {
|
|||
PhabricatorEditEngine $engine,
|
||||
PhabricatorApplicationTransactionInterface $object);
|
||||
|
||||
public function didBuildCustomEditFields(
|
||||
PhabricatorEditEngine $engine,
|
||||
PhabricatorApplicationTransactionInterface $object,
|
||||
array $fields) {
|
||||
return;
|
||||
}
|
||||
|
||||
final public static function getAllExtensions() {
|
||||
return id(new PhutilClassMapQuery())
|
||||
->setAncestorClass(__CLASS__)
|
||||
|
|
|
@ -11,6 +11,10 @@ final class PhabricatorCommentEditField
|
|||
return new PhabricatorCommentEditType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
public function shouldGenerateTransactionsFromSubmit() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -11,4 +11,8 @@ final class PhabricatorConduitEditField
|
|||
return null;
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitWildParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,10 +12,13 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
private $object;
|
||||
private $transactionType;
|
||||
private $metadata = array();
|
||||
private $description;
|
||||
private $editTypeKey;
|
||||
private $isRequired;
|
||||
|
||||
private $description;
|
||||
private $conduitDescription;
|
||||
private $conduitDocumentation;
|
||||
private $conduitTypeDescription;
|
||||
|
||||
private $commentActionLabel;
|
||||
private $commentActionValue;
|
||||
|
@ -35,6 +38,8 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
private $isCopyable = false;
|
||||
private $isConduitOnly = false;
|
||||
|
||||
private $conduitEditTypes;
|
||||
|
||||
public function setKey($key) {
|
||||
$this->key = $key;
|
||||
return $this;
|
||||
|
@ -80,15 +85,6 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
return $this->object;
|
||||
}
|
||||
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setIsLocked($is_locked) {
|
||||
$this->isLocked = $is_locked;
|
||||
return $this;
|
||||
|
@ -125,6 +121,45 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
return $this->isConduitOnly;
|
||||
}
|
||||
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setConduitDescription($conduit_description) {
|
||||
$this->conduitDescription = $conduit_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitDescription() {
|
||||
if ($this->conduitDescription === null) {
|
||||
return $this->getDescription();
|
||||
}
|
||||
return $this->conduitDescription;
|
||||
}
|
||||
|
||||
public function setConduitDocumentation($conduit_documentation) {
|
||||
$this->conduitDocumentation = $conduit_documentation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitDocumentation() {
|
||||
return $this->conduitDocumentation;
|
||||
}
|
||||
|
||||
public function setConduitTypeDescription($conduit_type_description) {
|
||||
$this->conduitTypeDescription = $conduit_type_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitTypeDescription() {
|
||||
return $this->conduitTypeDescription;
|
||||
}
|
||||
|
||||
public function setIsEditDefaults($is_edit_defaults) {
|
||||
$this->isEditDefaults = $is_edit_defaults;
|
||||
return $this;
|
||||
|
@ -516,6 +551,20 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
return new AphrontStringHTTPParameterType();
|
||||
}
|
||||
|
||||
public function getConduitParameterType() {
|
||||
$type = $this->newConduitParameterType();
|
||||
|
||||
if (!$type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$type->setViewer($this->getViewer());
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
abstract protected function newConduitParameterType();
|
||||
|
||||
public function setEditTypeKey($edit_type_key) {
|
||||
$this->editTypeKey = $edit_type_key;
|
||||
return $this;
|
||||
|
@ -529,16 +578,13 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
}
|
||||
|
||||
protected function newEditType() {
|
||||
// TODO: This could be a little cleaner.
|
||||
$http_type = $this->getHTTPParameterType();
|
||||
if ($http_type) {
|
||||
$value_type = $http_type->getTypeName();
|
||||
} else {
|
||||
$value_type = 'wild';
|
||||
$parameter_type = $this->getConduitParameterType();
|
||||
if (!$parameter_type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return id(new PhabricatorSimpleEditType())
|
||||
->setValueType($value_type);
|
||||
->setConduitParameterType($parameter_type);
|
||||
}
|
||||
|
||||
protected function getEditType() {
|
||||
|
@ -549,19 +595,49 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
}
|
||||
|
||||
$type_key = $this->getEditTypeKey();
|
||||
$edit_type = $this->newEditType();
|
||||
if (!$edit_type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->newEditType()
|
||||
return $edit_type
|
||||
->setEditType($type_key)
|
||||
->setTransactionType($transaction_type)
|
||||
->setDescription($this->getDescription())
|
||||
->setMetadata($this->getMetadata())
|
||||
->setConduitDocumentation($this->getConduitDocumentation());
|
||||
->setMetadata($this->getMetadata());
|
||||
}
|
||||
|
||||
public function getConduitEditTypes() {
|
||||
final public function getConduitEditTypes() {
|
||||
if ($this->conduitEditTypes === null) {
|
||||
$edit_types = $this->newConduitEditTypes();
|
||||
$edit_types = mpull($edit_types, null, 'getEditType');
|
||||
|
||||
foreach ($edit_types as $edit_type) {
|
||||
$edit_type->setEditField($this);
|
||||
}
|
||||
|
||||
$this->conduitEditTypes = $edit_types;
|
||||
}
|
||||
|
||||
return $this->conduitEditTypes;
|
||||
}
|
||||
|
||||
final public function getConduitEditType($key) {
|
||||
$edit_types = $this->getConduitEditTypes();
|
||||
|
||||
if (empty($edit_types[$key])) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'This EditField does not provide a Conduit EditType with key "%s".',
|
||||
$key));
|
||||
}
|
||||
|
||||
return $edit_types[$key];
|
||||
}
|
||||
|
||||
protected function newConduitEditTypes() {
|
||||
$edit_type = $this->getEditType();
|
||||
|
||||
if ($edit_type === null) {
|
||||
if (!$edit_type) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -679,13 +755,8 @@ abstract class PhabricatorEditField extends Phobject {
|
|||
return $edit_type->generateTransactions($template, $spec);
|
||||
}
|
||||
|
||||
public function setConduitDocumentation($conduit_documentation) {
|
||||
$this->conduitDocumentation = $conduit_documentation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitDocumentation() {
|
||||
return $this->conduitDocumentation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,4 +11,8 @@ final class PhabricatorInstructionsEditField
|
|||
return null;
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ abstract class PhabricatorPHIDListEditField
|
|||
extends PhabricatorEditField {
|
||||
|
||||
private $useEdgeTransactions;
|
||||
private $transactionDescriptions = array();
|
||||
private $isSingleValue;
|
||||
|
||||
public function setUseEdgeTransactions($use_edge_transactions) {
|
||||
|
@ -16,15 +15,6 @@ abstract class PhabricatorPHIDListEditField
|
|||
return $this->useEdgeTransactions;
|
||||
}
|
||||
|
||||
public function setEdgeTransactionDescriptions($add, $rem, $set) {
|
||||
$this->transactionDescriptions = array(
|
||||
'+' => $add,
|
||||
'-' => $rem,
|
||||
'=' => $set,
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSingleValue($value) {
|
||||
if ($value === null) {
|
||||
$value = array();
|
||||
|
@ -44,6 +34,10 @@ abstract class PhabricatorPHIDListEditField
|
|||
return new AphrontPHIDListHTTPParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitPHIDListParameterType();
|
||||
}
|
||||
|
||||
protected function getValueFromRequest(AphrontRequest $request, $key) {
|
||||
$value = parent::getValueFromRequest($request, $key);
|
||||
if ($this->getIsSingleValue()) {
|
||||
|
@ -105,9 +99,9 @@ abstract class PhabricatorPHIDListEditField
|
|||
return $type;
|
||||
}
|
||||
|
||||
public function getConduitEditTypes() {
|
||||
protected function newConduitEditTypes() {
|
||||
if (!$this->getUseEdgeTransactions()) {
|
||||
return parent::getConduitEditTypes();
|
||||
return parent::newConduitEditTypes();
|
||||
}
|
||||
|
||||
$transaction_type = $this->getTransactionType();
|
||||
|
@ -116,27 +110,26 @@ abstract class PhabricatorPHIDListEditField
|
|||
}
|
||||
|
||||
$type_key = $this->getEditTypeKey();
|
||||
$strings = $this->transactionDescriptions;
|
||||
|
||||
$base = $this->getEditType();
|
||||
|
||||
$add = id(clone $base)
|
||||
->setEditType($type_key.'.add')
|
||||
->setEdgeOperation('+')
|
||||
->setDescription(idx($strings, '+'))
|
||||
->setValueDescription(pht('List of PHIDs to add.'));
|
||||
->setConduitTypeDescription(pht('List of PHIDs to add.'))
|
||||
->setConduitParameterType($this->getConduitParameterType());
|
||||
|
||||
$rem = id(clone $base)
|
||||
->setEditType($type_key.'.remove')
|
||||
->setEdgeOperation('-')
|
||||
->setDescription(idx($strings, '-'))
|
||||
->setValueDescription(pht('List of PHIDs to remove.'));
|
||||
->setConduitTypeDescription(pht('List of PHIDs to remove.'))
|
||||
->setConduitParameterType($this->getConduitParameterType());
|
||||
|
||||
$set = id(clone $base)
|
||||
->setEditType($type_key.'.set')
|
||||
->setEdgeOperation('=')
|
||||
->setDescription(idx($strings, '='))
|
||||
->setValueDescription(pht('List of PHIDs to set.'));
|
||||
->setConduitTypeDescription(pht('List of PHIDs to set.'))
|
||||
->setConduitParameterType($this->getConduitParameterType());
|
||||
|
||||
return array(
|
||||
$add,
|
||||
|
|
|
@ -55,4 +55,9 @@ final class PhabricatorPolicyEditField
|
|||
return new AphrontPHIDHTTPParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,4 +11,8 @@ final class PhabricatorProjectsEditField
|
|||
return new AphrontProjectListHTTPParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitProjectListParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,4 +7,8 @@ final class PhabricatorRemarkupEditField
|
|||
return new PhabricatorRemarkupControl();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,4 +31,8 @@ final class PhabricatorSelectEditField
|
|||
->setOptions($this->getOptions());
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,4 +13,8 @@ final class PhabricatorSpaceEditField
|
|||
return new AphrontPHIDHTTPParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitPHIDParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,4 +13,8 @@ final class PhabricatorSubscribersEditField
|
|||
return new AphrontUserListHTTPParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitUserListParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,4 +39,8 @@ final class PhabricatorTextAreaEditField
|
|||
return $control;
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,4 +7,8 @@ final class PhabricatorTextEditField
|
|||
return new AphrontFormTextControl();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,4 +11,8 @@ final class PhabricatorUsersEditField
|
|||
return new AphrontUserListHTTPParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitUserListParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
final class PhabricatorCommentEditType extends PhabricatorEditType {
|
||||
|
||||
public function getValueType() {
|
||||
return id(new AphrontStringHTTPParameterType())->getTypeName();
|
||||
protected function newConduitParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
public function generateTransactions(
|
||||
|
@ -19,8 +19,4 @@ final class PhabricatorCommentEditType extends PhabricatorEditType {
|
|||
return array($xaction);
|
||||
}
|
||||
|
||||
public function getValueDescription() {
|
||||
return pht('Comment to add, formated as remarkup.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,13 +34,4 @@ final class PhabricatorEdgeEditType
|
|||
return array($xaction);
|
||||
}
|
||||
|
||||
public function setValueDescription($value_description) {
|
||||
$this->valueDescription = $value_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueDescription() {
|
||||
return $this->valueDescription;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,34 +3,16 @@
|
|||
abstract class PhabricatorEditType extends Phobject {
|
||||
|
||||
private $editType;
|
||||
private $editField;
|
||||
private $transactionType;
|
||||
private $label;
|
||||
private $field;
|
||||
private $description;
|
||||
private $summary;
|
||||
private $metadata = array();
|
||||
|
||||
private $conduitDescription;
|
||||
private $conduitDocumentation;
|
||||
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setSummary($summary) {
|
||||
$this->summary = $summary;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSummary() {
|
||||
if ($this->summary === null) {
|
||||
return $this->getDescription();
|
||||
}
|
||||
return $this->summary;
|
||||
}
|
||||
private $conduitTypeDescription;
|
||||
private $conduitParameterType;
|
||||
|
||||
public function setLabel($label) {
|
||||
$this->label = $label;
|
||||
|
@ -59,15 +41,6 @@ abstract class PhabricatorEditType extends Phobject {
|
|||
return $this->editType;
|
||||
}
|
||||
|
||||
public function setConduitDocumentation($conduit_documentation) {
|
||||
$this->conduitDocumentation = $conduit_documentation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitDocumentation() {
|
||||
return $this->conduitDocumentation;
|
||||
}
|
||||
|
||||
public function setMetadata($metadata) {
|
||||
$this->metadata = $metadata;
|
||||
return $this;
|
||||
|
@ -90,9 +63,6 @@ abstract class PhabricatorEditType extends Phobject {
|
|||
PhabricatorApplicationTransaction $template,
|
||||
array $spec);
|
||||
|
||||
abstract public function getValueType();
|
||||
abstract public function getValueDescription();
|
||||
|
||||
protected function newTransaction(
|
||||
PhabricatorApplicationTransaction $template) {
|
||||
|
||||
|
@ -106,4 +76,83 @@ abstract class PhabricatorEditType extends Phobject {
|
|||
return $xaction;
|
||||
}
|
||||
|
||||
public function setEditField(PhabricatorEditField $edit_field) {
|
||||
$this->editField = $edit_field;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEditField() {
|
||||
return $this->editField;
|
||||
}
|
||||
|
||||
/* -( Conduit )------------------------------------------------------------ */
|
||||
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
if ($this->conduitParameterType) {
|
||||
return clone $this->conduitParameterType;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setConduitParameterType(ConduitParameterType $type) {
|
||||
$this->conduitParameterType = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitParameterType() {
|
||||
return $this->newConduitParameterType();
|
||||
}
|
||||
|
||||
public function getConduitType() {
|
||||
$parameter_type = $this->getConduitParameterType();
|
||||
return $parameter_type->getTypeName();
|
||||
}
|
||||
|
||||
public function setConduitTypeDescription($conduit_type_description) {
|
||||
$this->conduitTypeDescription = $conduit_type_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitTypeDescription() {
|
||||
if ($this->conduitTypeDescription === null) {
|
||||
if ($this->getEditField()) {
|
||||
return $this->getEditField()->getConduitTypeDescription();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->conduitTypeDescription;
|
||||
}
|
||||
|
||||
public function setConduitDescription($conduit_description) {
|
||||
$this->conduitDescription = $conduit_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitDescription() {
|
||||
if ($this->conduitDescription === null) {
|
||||
if ($this->getEditField()) {
|
||||
return $this->getEditField()->getConduitDescription();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->conduitDescription;
|
||||
}
|
||||
|
||||
public function setConduitDocumentation($conduit_documentation) {
|
||||
$this->conduitDocumentation = $conduit_documentation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConduitDocumentation() {
|
||||
if ($this->conduitDocumentation === null) {
|
||||
if ($this->getEditField()) {
|
||||
return $this->getEditField()->getConduitDocumentation();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->conduitDocumentation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,4 +42,17 @@ abstract class PhabricatorPHIDListEditType
|
|||
}
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
$default = parent::newConduitParameterType();
|
||||
if ($default) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
if ($this->getIsSingleValue()) {
|
||||
return new ConduitPHIDParameterType();
|
||||
} else {
|
||||
return new ConduitPHIDListParameterType();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,20 +2,6 @@
|
|||
|
||||
final class PhabricatorSimpleEditType extends PhabricatorEditType {
|
||||
|
||||
private $valueType;
|
||||
private $valueDescription;
|
||||
private $phuixControlType;
|
||||
private $phuixControlSpecification = array();
|
||||
|
||||
public function setValueType($value_type) {
|
||||
$this->valueType = $value_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueType() {
|
||||
return $this->valueType;
|
||||
}
|
||||
|
||||
public function generateTransactions(
|
||||
PhabricatorApplicationTransaction $template,
|
||||
array $spec) {
|
||||
|
@ -26,13 +12,4 @@ final class PhabricatorSimpleEditType extends PhabricatorEditType {
|
|||
return array($edit);
|
||||
}
|
||||
|
||||
public function setValueDescription($value_description) {
|
||||
$this->valueDescription = $value_description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueDescription() {
|
||||
return $this->valueDescription;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ final class PhabricatorCustomFieldEditField
|
|||
|
||||
private $customField;
|
||||
private $httpParameterType;
|
||||
private $conduitParameterType;
|
||||
|
||||
public function setCustomField(PhabricatorCustomField $custom_field) {
|
||||
$this->customField = $custom_field;
|
||||
|
@ -25,6 +26,16 @@ final class PhabricatorCustomFieldEditField
|
|||
return $this->httpParameterType;
|
||||
}
|
||||
|
||||
public function setCustomFieldConduitParameterType(
|
||||
ConduitParameterType $type) {
|
||||
$this->conduitParameterType = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomFieldConduitParameterType() {
|
||||
return $this->conduitParameterType;
|
||||
}
|
||||
|
||||
protected function buildControl() {
|
||||
$field = $this->getCustomField();
|
||||
$clone = clone $field;
|
||||
|
@ -36,14 +47,15 @@ final class PhabricatorCustomFieldEditField
|
|||
}
|
||||
|
||||
protected function newEditType() {
|
||||
$type = id(new PhabricatorCustomFieldEditType())
|
||||
->setCustomField($this->getCustomField());
|
||||
|
||||
$http_type = $this->getHTTPParameterType();
|
||||
if ($http_type) {
|
||||
$type->setValueType($http_type->getTypeName());
|
||||
$conduit_type = $this->newConduitParameterType();
|
||||
if (!$conduit_type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$type = id(new PhabricatorCustomFieldEditType())
|
||||
->setCustomField($this->getCustomField())
|
||||
->setConduitParameterType($conduit_type);
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
@ -71,14 +83,14 @@ final class PhabricatorCustomFieldEditField
|
|||
return $clone->getNewValueForApplicationTransactions();
|
||||
}
|
||||
|
||||
public function getConduitEditTypes() {
|
||||
protected function newConduitEditTypes() {
|
||||
$field = $this->getCustomField();
|
||||
|
||||
if (!$field->shouldAppearInConduitTransactions()) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return parent::getConduitEditTypes();
|
||||
return parent::newConduitEditTypes();
|
||||
}
|
||||
|
||||
protected function newHTTPParameterType() {
|
||||
|
@ -91,6 +103,16 @@ final class PhabricatorCustomFieldEditField
|
|||
return null;
|
||||
}
|
||||
|
||||
protected function newConduitParameterType() {
|
||||
$type = $this->getCustomFieldConduitParameterType();
|
||||
|
||||
if ($type) {
|
||||
return clone $type;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAllReadValueFromRequestKeys() {
|
||||
$keys = array();
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ final class PhabricatorCustomFieldEditType
|
|||
extends PhabricatorEditType {
|
||||
|
||||
private $customField;
|
||||
private $valueType;
|
||||
|
||||
public function setCustomField(PhabricatorCustomField $custom_field) {
|
||||
$this->customField = $custom_field;
|
||||
|
@ -15,25 +14,11 @@ final class PhabricatorCustomFieldEditType
|
|||
return $this->customField;
|
||||
}
|
||||
|
||||
public function setValueType($value_type) {
|
||||
$this->valueType = $value_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueType() {
|
||||
return $this->valueType;
|
||||
}
|
||||
|
||||
public function getMetadata() {
|
||||
$field = $this->getCustomField();
|
||||
return parent::getMetadata() + $field->getApplicationTransactionMetadata();
|
||||
}
|
||||
|
||||
public function getValueDescription() {
|
||||
$field = $this->getCustomField();
|
||||
return $field->getFieldDescription();
|
||||
}
|
||||
|
||||
public function generateTransactions(
|
||||
PhabricatorApplicationTransaction $template,
|
||||
array $spec) {
|
||||
|
|
|
@ -1106,6 +1106,11 @@ abstract class PhabricatorCustomField extends Phobject {
|
|||
$field->setCustomFieldHTTPParameterType($http_type);
|
||||
}
|
||||
|
||||
$conduit_type = $this->getConduitEditParameterType();
|
||||
if ($conduit_type) {
|
||||
$field->setCustomFieldConduitParameterType($conduit_type);
|
||||
}
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
|
@ -1348,6 +1353,17 @@ abstract class PhabricatorCustomField extends Phobject {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function getConduitEditParameterType() {
|
||||
return $this->newConduitEditParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
if ($this->proxy) {
|
||||
return $this->proxy->newConduitEditParameterType();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/* -( Herald )------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -136,4 +136,9 @@ final class PhabricatorStandardCustomFieldBool
|
|||
protected function newConduitSearchParameterType() {
|
||||
return new ConduitBoolParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitBoolParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -202,4 +202,8 @@ final class PhabricatorStandardCustomFieldDate
|
|||
return null;
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitEpochParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -120,4 +120,8 @@ final class PhabricatorStandardCustomFieldInt
|
|||
return new ConduitIntParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitIntParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,4 +87,9 @@ final class PhabricatorStandardCustomFieldLink
|
|||
protected function newConduitSearchParameterType() {
|
||||
return new ConduitStringListParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -143,4 +143,9 @@ final class PhabricatorStandardCustomFieldSelect
|
|||
protected function newConduitSearchParameterType() {
|
||||
return new ConduitStringListParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,4 +19,8 @@ final class PhabricatorStandardCustomFieldUsers
|
|||
return new ConduitUserListParameterType();
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitUserListParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue