diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php index 85f8e28a5c..6a2a4133c9 100644 --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -39,6 +39,7 @@ final class DifferentialRevisionQuery private $branches = array(); private $arcanistProjectPHIDs = array(); private $draftRevisions = array(); + private $repositoryPHIDs; private $order = 'order-modified'; const ORDER_MODIFIED = 'order-modified'; @@ -246,6 +247,11 @@ final class DifferentialRevisionQuery return $this; } + public function withRepositoryPHIDs(array $repository_phids) { + $this->repositoryPHIDs = $repository_phids; + return $this; + } + /** * Set result ordering. Provide a class constant, such as @@ -658,6 +664,13 @@ final class DifferentialRevisionQuery $this->revIDs); } + if ($this->repositoryPHIDs) { + $where[] = qsprintf( + $conn_r, + 'r.repositoryPHID IN (%Ls)', + $this->repositoryPHIDs); + } + if ($this->commitHashes) { $hash_clauses = array(); foreach ($this->commitHashes as $info) { diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php index ffd1e196f7..377d2b600d 100644 --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -29,6 +29,10 @@ final class DifferentialRevisionSearchEngine 'subscriberPHIDs', $this->readUsersFromRequest($request, 'subscribers')); + $saved->setParameter( + 'repositoryPHIDs', + $request->getArr('repositories')); + $saved->setParameter( 'draft', $request->getBool('draft')); @@ -68,6 +72,11 @@ final class DifferentialRevisionSearchEngine $query->withCCs($subscriber_phids); } + $repository_phids = $saved->getParameter('repositoryPHIDs', array()); + if ($repository_phids) { + $query->withRepositoryPHIDs($repository_phids); + } + $draft = $saved->getParameter('draft', false); if ($draft && $this->requireViewer()->isLoggedIn()) { $query->withDraftRepliesByAuthors( @@ -97,6 +106,7 @@ final class DifferentialRevisionSearchEngine $author_phids = $saved->getParameter('authorPHIDs', array()); $reviewer_phids = $saved->getParameter('reviewerPHIDs', array()); $subscriber_phids = $saved->getParameter('subscriberPHIDs', array()); + $repository_phids = $saved->getParameter('repositoryPHIDs', array()); $only_draft = $saved->getParameter('draft', false); $all_phids = array_mergev( @@ -105,6 +115,7 @@ final class DifferentialRevisionSearchEngine $author_phids, $reviewer_phids, $subscriber_phids, + $repository_phids, )); $handles = id(new PhabricatorHandleQuery()) @@ -112,33 +123,37 @@ final class DifferentialRevisionSearchEngine ->withPHIDs($all_phids) ->execute(); - $tokens = mpull($handles, 'getFullName', 'getPHID'); - $form ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Responsible Users')) ->setName('responsibles') ->setDatasource('/typeahead/common/accounts/') - ->setValue(array_select_keys($tokens, $responsible_phids))) + ->setValue(array_select_keys($handles, $responsible_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Authors')) ->setName('authors') ->setDatasource('/typeahead/common/accounts/') - ->setValue(array_select_keys($tokens, $author_phids))) + ->setValue(array_select_keys($handles, $author_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Reviewers')) ->setName('reviewers') ->setDatasource('/typeahead/common/accounts/') - ->setValue(array_select_keys($tokens, $reviewer_phids))) + ->setValue(array_select_keys($handles, $reviewer_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Subscribers')) ->setName('subscribers') ->setDatasource('/typeahead/common/allmailable/') - ->setValue(array_select_keys($tokens, $subscriber_phids))) + ->setValue(array_select_keys($handles, $subscriber_phids))) + ->appendChild( + id(new AphrontFormTokenizerControl()) + ->setLabel(pht('Repositories')) + ->setName('repositories') + ->setDatasource('/typeahead/common/repositories/') + ->setValue(array_select_keys($handles, $repository_phids))) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Status'))