@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

DiffusionCommitQuery - move phid to id mapping

Summary: Ref T5862. makes the exception work better

Test Plan: issued some queries from audit ui with and without repos - they worked

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5862

Differential Revision: https://secure.phabricator.com/D10268

+18 -14
-3
src/applications/audit/query/PhabricatorCommitSearchEngine.php
··· 61 61 62 62 $repository_phids = $saved->getParameter('repositoryPHIDs', array()); 63 63 if ($repository_phids) { 64 - // $repository_phids need to be mapped to $repository_ids via a subquery 65 - // so make sure $viewer is set...! 66 - $query->setViewer($this->requireViewer()); 67 64 $query->withRepositoryPHIDs($repository_phids); 68 65 } 69 66
+18 -11
src/applications/diffusion/query/DiffusionCommitQuery.php
··· 9 9 private $defaultRepository; 10 10 private $identifiers; 11 11 private $repositoryIDs; 12 + private $repositoryPHIDs; 12 13 private $identifierMap; 13 14 14 15 private $needAuditRequests; ··· 63 64 * Look up commits in a specific repository. Prefer 64 65 * @{method:withRepositoryIDs}; the underyling table is keyed by ID such 65 66 * that this method requires a separate initial query to map PHID to ID. 66 - * Furthermore, this method requires calling @{method:setViewer} in 67 - * advance due to the separate query. 68 67 */ 69 68 public function withRepositoryPHIDs(array $phids) { 70 - $repositories = id (new PhabricatorRepositoryQuery()) 71 - ->setViewer($this->getViewer()) 72 - ->withPHIDs($phids) 73 - ->execute(); 74 - 75 - if (!$repositories) { 76 - throw new PhabricatorEmptyQueryException(); 77 - } 78 - $this->withRepositoryIDs(mpull($repositories, 'getID')); 69 + $this->repositoryPHIDs = $phids; 79 70 } 80 71 81 72 /** ··· 281 272 282 273 private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 283 274 $where = array(); 275 + 276 + if ($this->repositoryPHIDs !== null) { 277 + $map_repositories = id (new PhabricatorRepositoryQuery()) 278 + ->setViewer($this->getViewer()) 279 + ->withPHIDs($this->repositoryPHIDs) 280 + ->execute(); 281 + 282 + if (!$map_repositories) { 283 + throw new PhabricatorEmptyQueryException(); 284 + } 285 + $repository_ids = mpull($map_repositories, 'getID'); 286 + if ($this->repositoryIDs !== null) { 287 + $repository_ids = array_merge($repository_ids, $this->repositoryIDs); 288 + } 289 + $this->withRepositoryIDs($repository_ids); 290 + } 284 291 285 292 if ($this->ids !== null) { 286 293 $where[] = qsprintf(