Page MenuHomePhabricator

D10268.id24726.diff
No OneTemporary

D10268.id24726.diff

diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php
--- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php
+++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php
@@ -61,9 +61,6 @@
$repository_phids = $saved->getParameter('repositoryPHIDs', array());
if ($repository_phids) {
- // $repository_phids need to be mapped to $repository_ids via a subquery
- // so make sure $viewer is set...!
- $query->setViewer($this->requireViewer());
$query->withRepositoryPHIDs($repository_phids);
}
diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php
--- a/src/applications/diffusion/query/DiffusionCommitQuery.php
+++ b/src/applications/diffusion/query/DiffusionCommitQuery.php
@@ -9,6 +9,7 @@
private $defaultRepository;
private $identifiers;
private $repositoryIDs;
+ private $repositoryPHIDs;
private $identifierMap;
private $needAuditRequests;
@@ -63,19 +64,9 @@
* Look up commits in a specific repository. Prefer
* @{method:withRepositoryIDs}; the underyling table is keyed by ID such
* that this method requires a separate initial query to map PHID to ID.
- * Furthermore, this method requires calling @{method:setViewer} in
- * advance due to the separate query.
*/
public function withRepositoryPHIDs(array $phids) {
- $repositories = id (new PhabricatorRepositoryQuery())
- ->setViewer($this->getViewer())
- ->withPHIDs($phids)
- ->execute();
-
- if (!$repositories) {
- throw new PhabricatorEmptyQueryException();
- }
- $this->withRepositoryIDs(mpull($repositories, 'getID'));
+ $this->repositoryPHIDs = $phids;
}
/**
@@ -282,6 +273,22 @@
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
+ if ($this->repositoryPHIDs !== null) {
+ $map_repositories = id (new PhabricatorRepositoryQuery())
+ ->setViewer($this->getViewer())
+ ->withPHIDs($this->repositoryPHIDs)
+ ->execute();
+
+ if (!$map_repositories) {
+ throw new PhabricatorEmptyQueryException();
+ }
+ $repository_ids = mpull($map_repositories, 'getID');
+ if ($this->repositoryIDs !== null) {
+ $repository_ids = array_merge($repository_ids, $this->repositoryIDs);
+ }
+ $this->withRepositoryIDs($repository_ids);
+ }
+
if ($this->ids !== null) {
$where[] = qsprintf(
$conn_r,

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 13, 12:04 AM (6 d, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6743485
Default Alt Text
D10268.id24726.diff (2 KB)

Event Timeline