@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.

Policy - lock down DiffusionSymbolQuery repo-loading code

Summary: Ref T7094.

Test Plan: couldn't really test this - how does one get symbols going nowadays given they are acanist project based?

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7094

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

+25 -7
+2 -1
src/applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php
··· 37 37 $language = $request->getValue('language'); 38 38 $type = $request->getValue('type'); 39 39 40 - $query = new DiffusionSymbolQuery(); 40 + $query = id(new DiffusionSymbolQuery()) 41 + ->setViewer($request->getUser()); 41 42 if ($name !== null) { 42 43 $query->setName($name); 43 44 }
+3 -2
src/applications/diffusion/controller/DiffusionSymbolController.php
··· 8 8 $user = $request->getUser(); 9 9 $this->name = $request->getURIData('name'); 10 10 11 - $query = new DiffusionSymbolQuery(); 12 - $query->setName($this->name); 11 + $query = id(new DiffusionSymbolQuery()) 12 + ->setViewer($user) 13 + ->setName($this->name); 13 14 14 15 if ($request->getStr('context') !== null) { 15 16 $query->setContext($request->getStr('context'));
+19 -4
src/applications/diffusion/query/DiffusionSymbolQuery.php
··· 11 11 */ 12 12 final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery { 13 13 14 + private $viewer; 14 15 private $context; 15 16 private $namePrefix; 16 17 private $name; ··· 26 27 27 28 /* -( Configuring the Query )---------------------------------------------- */ 28 29 30 + /** 31 + * @task config 32 + */ 33 + public function setViewer(PhabricatorUser $viewer) { 34 + $this->viewer = $viewer; 35 + return $this; 36 + } 37 + 38 + /** 39 + * @task config 40 + */ 41 + public function getViewer() { 42 + return $this->viewer; 43 + } 29 44 30 45 /** 31 46 * @task config ··· 263 278 $repo_ids = array_filter($repo_ids); 264 279 265 280 if ($repo_ids) { 266 - // TODO: (T603) Provide a viewer here. 267 - $repos = id(new PhabricatorRepository())->loadAllWhere( 268 - 'id IN (%Ld)', 269 - $repo_ids); 281 + $repos = id(new PhabricatorRepositoryQuery()) 282 + ->setViewer($this->getViewer()) 283 + ->withIDs($repo_ids) 284 + ->execute(); 270 285 } else { 271 286 $repos = array(); 272 287 }
+1
src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php
··· 19 19 20 20 if (strlen($raw_query)) { 21 21 $symbols = id(new DiffusionSymbolQuery()) 22 + ->setViewer($viewer) 22 23 ->setNamePrefix($raw_query) 23 24 ->setLimit(15) 24 25 ->needArcanistProjects(true)