Page MenuHomePhabricator

D20208.id.diff
No OneTemporary

D20208.id.diff

diff --git a/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php b/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php
--- a/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php
+++ b/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php
@@ -73,24 +73,8 @@
->setViewer($viewer);
$constraints = $request->getValue('constraints', array());
- PhutilTypeSpec::checkMap(
- $constraints,
- array(
- 'phids' => 'optional list<string>',
- ));
- $with_phids = idx($constraints, 'phids');
-
- if ($with_phids === array()) {
- throw new Exception(
- pht(
- 'Constraint "phids" to "transaction.search" requires nonempty list, '.
- 'empty list provided.'));
- }
-
- if ($with_phids) {
- $xaction_query->withPHIDs($with_phids);
- }
+ $xaction_query = $this->applyConstraints($constraints, $xaction_query);
$xactions = $xaction_query->executeWithCursorPager($pager);
@@ -240,4 +224,45 @@
return $this->addPagerResults($results, $pager);
}
+
+ private function applyConstraints(
+ array $constraints,
+ PhabricatorApplicationTransactionQuery $query) {
+
+ PhutilTypeSpec::checkMap(
+ $constraints,
+ array(
+ 'phids' => 'optional list<string>',
+ 'authorPHIDs' => 'optional list<string>',
+ ));
+
+ $with_phids = idx($constraints, 'phids');
+
+ if ($with_phids === array()) {
+ throw new Exception(
+ pht(
+ 'Constraint "phids" to "transaction.search" requires nonempty list, '.
+ 'empty list provided.'));
+ }
+
+ if ($with_phids) {
+ $query->withPHIDs($with_phids);
+ }
+
+ $with_authors = idx($constraints, 'authorPHIDs');
+ if ($with_authors === array()) {
+ throw new Exception(
+ pht(
+ 'Constraint "authorPHIDs" to "transaction.search" requires '.
+ 'nonempty list, empty list provided.'));
+ }
+
+ if ($with_authors) {
+ $query->withAuthorPHIDs($with_authors);
+ }
+
+ return $query;
+ }
+
+
}

File Metadata

Mime Type
text/plain
Expires
Mon, May 20, 1:26 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6271553
Default Alt Text
D20208.id.diff (2 KB)

Event Timeline