1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +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:
epriestley 2018-02-09 11:46:02 -08:00
parent dc2995c4ca
commit 4887c6aa80

View file

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