mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Allow "transaction.search" to be constrained by PHIDs
Summary: Depends on D19046. Ref T11330. Supports querying for specific transactions while responding to webhooks. Test Plan: Called `transaction.search` with and without PHID constraints. Maniphest Tasks: T11330 Differential Revision: https://secure.phabricator.com/D19047
This commit is contained in:
parent
dc2995c4ca
commit
4887c6aa80
1 changed files with 17 additions and 3 deletions
|
@ -22,6 +22,7 @@ final class TransactionSearchConduitAPIMethod
|
|||
protected function defineParamTypes() {
|
||||
return array(
|
||||
'objectIdentifier' => 'phid|string',
|
||||
'constraints' => 'map<string, wild>',
|
||||
) + $this->getPagerParamTypes();
|
||||
}
|
||||
|
||||
|
@ -66,10 +67,23 @@ final class TransactionSearchConduitAPIMethod
|
|||
$xaction_query = PhabricatorApplicationTransactionQuery::newQueryForObject(
|
||||
$object);
|
||||
|
||||
$xactions = $xaction_query
|
||||
$xaction_query
|
||||
->withObjectPHIDs(array($object->getPHID()))
|
||||
->setViewer($viewer)
|
||||
->executeWithCursorPager($pager);
|
||||
->setViewer($viewer);
|
||||
|
||||
$constraints = $request->getValue('constraints', array());
|
||||
PhutilTypeSpec::checkMap(
|
||||
$constraints,
|
||||
array(
|
||||
'phids' => 'optional list<string>',
|
||||
));
|
||||
|
||||
$with_phids = idx($constraints, 'phids');
|
||||
if ($with_phids) {
|
||||
$xaction_query->withPHIDs($with_phids);
|
||||
}
|
||||
|
||||
$xactions = $xaction_query->executeWithCursorPager($pager);
|
||||
|
||||
if ($xactions) {
|
||||
$template = head($xactions)->getApplicationTransactionCommentObject();
|
||||
|
|
Loading…
Reference in a new issue