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

Fix symbol handling in symbol query and IRC "Where is x?" handler

Summary: If a symbol's project has no linked repository, we currently explode. Instead, decline to generate a URI and fall back gracefully.

Test Plan: https://secure.phabricator.com/chatlog/channel/%23phabricator/?at=22345

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1465

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

+18 -4
+7 -1
src/applications/conduit/method/diffusion/ConduitAPI_diffusion_findsymbols_Method.php
··· 70 70 71 71 $results = $query->execute(); 72 72 73 + 73 74 $response = array(); 74 75 foreach ($results as $result) { 76 + $uri = $result->getURI(); 77 + if ($uri) { 78 + $uri = PhabricatorEnv::getProductionURI($uri); 79 + } 80 + 75 81 $response[] = array( 76 82 'name' => $result->getSymbolName(), 77 83 'type' => $result->getSymbolType(), 78 84 'language' => $result->getSymbolLanguage(), 79 85 'path' => $result->getPath(), 80 86 'line' => $result->getLineNumber(), 81 - 'uri' => PhabricatorEnv::getProductionURI($result->getURI()), 87 + 'uri' => $uri, 82 88 ); 83 89 } 84 90
+7
src/applications/repository/storage/PhabricatorRepositorySymbol.php
··· 45 45 } 46 46 47 47 public function getURI() { 48 + if (!$this->repository) { 49 + // This symbol is in the index, but we don't know which Repository it's 50 + // part of. Usually this means the Arcanist Project hasn't been linked 51 + // to a Repository. We can't generate a URI, so just fail. 52 + return null; 53 + } 54 + 48 55 $request = DiffusionRequest::newFromDictionary( 49 56 array( 50 57 'repository' => $this->getRepository(),
+4 -3
src/infrastructure/daemon/irc/handler/PhabricatorIRCObjectNameHandler.php
··· 240 240 'name' => $symbol, 241 241 )); 242 242 243 + $default_uri = $this->getURI('/diffusion/symbol/'.$symbol.'/'); 244 + 243 245 if (count($results) > 1) { 244 - $uri = $this->getURI('/diffusion/symbol/'.$symbol.'/'); 245 - $response = "Multiple symbols named '{$symbol}': {$uri}"; 246 + $response = "Multiple symbols named '{$symbol}': {$default_uri}"; 246 247 } else if (count($results) == 1) { 247 248 $result = head($results); 248 249 $response = 249 250 $result['type'].' '. 250 251 $result['name'].' '. 251 252 '('.$result['language'].'): '. 252 - $result['uri']; 253 + nonempty($result['uri'], $default_uri); 253 254 } else { 254 255 $response = "No symbol '{$symbol}' found anywhere."; 255 256 }