@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

Add repository parameter to `diffusion.findsymbols` method

Summary: Ref T7977. Add a repository parameter to the `diffusion.findsymbols` Conduit method to allow restricting search results to the specified repository.

Test Plan: Queried the Conduit endpoint.

Reviewers: avivey, epriestley, #blessed_reviewers

Reviewed By: avivey, epriestley, #blessed_reviewers

Subscribers: eadler, avivey, Korvin, epriestley

Maniphest Tasks: T7977

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

+18 -12
+18 -12
src/applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php
··· 13 13 14 14 protected function defineParamTypes() { 15 15 return array( 16 - 'name' => 'optional string', 17 - 'namePrefix' => 'optional string', 18 - 'context' => 'optional string', 19 - 'language' => 'optional string', 20 - 'type' => 'optional string', 16 + 'name' => 'optional string', 17 + 'namePrefix' => 'optional string', 18 + 'context' => 'optional string', 19 + 'language' => 'optional string', 20 + 'type' => 'optional string', 21 + 'repositoryPHID' => 'optional string', 21 22 ); 22 23 } 23 24 ··· 31 32 $context = $request->getValue('context'); 32 33 $language = $request->getValue('language'); 33 34 $type = $request->getValue('type'); 35 + $repository = $request->getValue('repositoryPHID'); 34 36 35 37 $query = id(new DiffusionSymbolQuery()) 36 38 ->setViewer($request->getUser()); ··· 48 50 } 49 51 if ($type !== null) { 50 52 $query->setType($type); 53 + } 54 + if ($repository !== null) { 55 + $query->withRepositoryPHIDs(array($repository)); 51 56 } 52 57 53 58 $query->needPaths(true); ··· 64 69 } 65 70 66 71 $response[] = array( 67 - 'name' => $result->getSymbolName(), 68 - 'context' => $result->getSymbolContext(), 69 - 'type' => $result->getSymbolType(), 70 - 'language' => $result->getSymbolLanguage(), 71 - 'path' => $result->getPath(), 72 - 'line' => $result->getLineNumber(), 73 - 'uri' => $uri, 72 + 'name' => $result->getSymbolName(), 73 + 'context' => $result->getSymbolContext(), 74 + 'type' => $result->getSymbolType(), 75 + 'language' => $result->getSymbolLanguage(), 76 + 'path' => $result->getPath(), 77 + 'line' => $result->getLineNumber(), 78 + 'uri' => $uri, 79 + 'repositoryPHID' => $result->getRepository()->getPHID(), 74 80 ); 75 81 } 76 82