mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Expose "commits.add|set|remove" on "maniphest.edit" API calls
Summary: See PHI1396. Ideally this would be some kind of general-purpose tie-in to object relationships, but see D18456 for precedent. Test Plan: Used `maniphest.edit` to edit associated commits for a task. Differential Revision: https://secure.phabricator.com/D20731
This commit is contained in:
parent
353155a203
commit
ecbc82da33
1 changed files with 20 additions and 1 deletions
|
@ -261,6 +261,7 @@ EODOCS
|
|||
|
||||
$parent_type = ManiphestTaskDependedOnByTaskEdgeType::EDGECONST;
|
||||
$subtask_type = ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
|
||||
$commit_type = ManiphestTaskHasCommitEdgeType::EDGECONST;
|
||||
|
||||
$src_phid = $object->getPHID();
|
||||
if ($src_phid) {
|
||||
|
@ -270,6 +271,7 @@ EODOCS
|
|||
array(
|
||||
$parent_type,
|
||||
$subtask_type,
|
||||
$commit_type,
|
||||
));
|
||||
$edge_query->execute();
|
||||
|
||||
|
@ -280,9 +282,14 @@ EODOCS
|
|||
$subtask_phids = $edge_query->getDestinationPHIDs(
|
||||
array($src_phid),
|
||||
array($subtask_type));
|
||||
|
||||
$commit_phids = $edge_query->getDestinationPHIDs(
|
||||
array($src_phid),
|
||||
array($commit_type));
|
||||
} else {
|
||||
$parent_phids = array();
|
||||
$subtask_phids = array();
|
||||
$commit_phids = array();
|
||||
}
|
||||
|
||||
$fields[] = id(new PhabricatorHandlesEditField())
|
||||
|
@ -307,7 +314,19 @@ EODOCS
|
|||
->setIsFormField(false)
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||
->setMetadataValue('edge:type', $subtask_type)
|
||||
->setValue($parent_phids);
|
||||
->setValue($subtask_phids);
|
||||
|
||||
$fields[] = id(new PhabricatorHandlesEditField())
|
||||
->setKey('commits')
|
||||
->setLabel(pht('Commits'))
|
||||
->setDescription(pht('Related commits.'))
|
||||
->setConduitDescription(pht('Change the related commits for this task.'))
|
||||
->setConduitTypeDescription(pht('List of related commit PHIDs.'))
|
||||
->setUseEdgeTransactions(true)
|
||||
->setIsFormField(false)
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||
->setMetadataValue('edge:type', $commit_type)
|
||||
->setValue($commit_phids);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue