mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 18:22:41 +01:00
Allow task parents and subtasks to be edited via Conduit API
Summary: See PHI39. This adds support for editing parents and subtasks of a task via Conduit. It might be nice to tie this into the `PhabricatorObjectRelationship` stuff eventually, but I think we'd effectively end up in the same place anyway in terms of what the API looks like. Test Plan: {F5116163} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18456
This commit is contained in:
parent
63bd1784b0
commit
68df3cebc8
1 changed files with 50 additions and 0 deletions
|
@ -251,6 +251,56 @@ EODOCS
|
||||||
id(new PHUIRemarkupPreviewPanel())
|
id(new PHUIRemarkupPreviewPanel())
|
||||||
->setHeader(pht('Description Preview')));
|
->setHeader(pht('Description Preview')));
|
||||||
|
|
||||||
|
$parent_type = ManiphestTaskDependedOnByTaskEdgeType::EDGECONST;
|
||||||
|
$subtask_type = ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
|
||||||
|
|
||||||
|
$src_phid = $object->getPHID();
|
||||||
|
if ($src_phid) {
|
||||||
|
$edge_query = id(new PhabricatorEdgeQuery())
|
||||||
|
->withSourcePHIDs(array($src_phid))
|
||||||
|
->withEdgeTypes(
|
||||||
|
array(
|
||||||
|
$parent_type,
|
||||||
|
$subtask_type,
|
||||||
|
));
|
||||||
|
$edge_query->execute();
|
||||||
|
|
||||||
|
$parent_phids = $edge_query->getDestinationPHIDs(
|
||||||
|
array($src_phid),
|
||||||
|
array($parent_type));
|
||||||
|
|
||||||
|
$subtask_phids = $edge_query->getDestinationPHIDs(
|
||||||
|
array($src_phid),
|
||||||
|
array($subtask_type));
|
||||||
|
} else {
|
||||||
|
$parent_phids = array();
|
||||||
|
$subtask_phids = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields[] = id(new PhabricatorHandlesEditField())
|
||||||
|
->setKey('parents')
|
||||||
|
->setLabel(pht('Parents'))
|
||||||
|
->setDescription(pht('Parent tasks.'))
|
||||||
|
->setConduitDescription(pht('Change the parents of this task.'))
|
||||||
|
->setConduitTypeDescription(pht('List of parent task PHIDs.'))
|
||||||
|
->setUseEdgeTransactions(true)
|
||||||
|
->setIsConduitOnly(true)
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
|
->setMetadataValue('edge:type', $parent_type)
|
||||||
|
->setValue($parent_phids);
|
||||||
|
|
||||||
|
$fields[] = id(new PhabricatorHandlesEditField())
|
||||||
|
->setKey('subtasks')
|
||||||
|
->setLabel(pht('Subtasks'))
|
||||||
|
->setDescription(pht('Subtasks.'))
|
||||||
|
->setConduitDescription(pht('Change the subtasks of this task.'))
|
||||||
|
->setConduitTypeDescription(pht('List of subtask PHIDs.'))
|
||||||
|
->setUseEdgeTransactions(true)
|
||||||
|
->setIsConduitOnly(true)
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
|
->setMetadataValue('edge:type', $subtask_type)
|
||||||
|
->setValue($parent_phids);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue