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

Only link symbols if there might be any

Summary:
fixes T8260. Only turn on symbol links if:
- The repository has any configuration about symbols, or
- There actually are symbols in the repository.

Test Plan: Look at revisions and files in various states of configurations and having symbols.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: joshuaspence, Korvin, epriestley

Maniphest Tasks: T8260

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

authored by

Aviv Eyal and committed by
epriestley
f21972a0 a04af2a9

+51 -15
+14 -13
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 261 261 262 262 $repository = $revision->getRepository(); 263 263 if ($repository) { 264 - list($symbol_indexes, $repository_phids) = $this->buildSymbolIndexes( 264 + $symbol_indexes = $this->buildSymbolIndexes( 265 265 $repository, 266 266 $visible_changesets); 267 267 } else { 268 268 $symbol_indexes = array(); 269 - $repository_phids = null; 270 269 } 271 270 272 271 $revision_detail->setActions($actions); ··· 305 304 'id' => $wrap_id, 306 305 ), 307 306 $comment_view); 308 - 309 - if ($repository) { 310 - Javelin::initBehavior( 311 - 'repository-crossreference', 312 - array( 313 - 'section' => $wrap_id, 314 - 'repositories' => $repository_phids, 315 - )); 316 - } 317 307 318 308 $changeset_view = new DifferentialChangesetListView(); 319 309 $changeset_view->setChangesets($changesets); ··· 758 748 $langs = $repository->getSymbolLanguages(); 759 749 $langs = nonempty($langs, array()); 760 750 751 + $sources = $repository->getSymbolSources(); 752 + $sources = nonempty($sources, array()); 753 + 761 754 $symbol_indexes = array(); 762 755 756 + if ($langs && $sources) { 757 + $have_symbols = id(new DiffusionSymbolQuery()) 758 + ->existsSymbolsInRepository($repository->getPHID()); 759 + if (!$have_symbols) { 760 + return $symbol_indexes; 761 + } 762 + } 763 + 763 764 $repository_phids = array_merge( 764 765 array($repository->getPHID()), 765 - nonempty($repository->getSymbolSources(), array())); 766 + $sources); 766 767 767 768 $indexed_langs = array_fill_keys($langs, true); 768 769 foreach ($visible_changesets as $key => $changeset) { ··· 775 776 } 776 777 } 777 778 778 - return array($symbol_indexes, $repository_phids); 779 + return $symbol_indexes; 779 780 } 780 781 781 782 private function loadOtherRevisions(
+17 -2
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 267 267 $id = celerity_generate_unique_node_id(); 268 268 269 269 $repo = $drequest->getRepository(); 270 - $symbol_repos = $repo->getSymbolSources(); 270 + $symbol_repos = nonempty($repo->getSymbolSources(), array()); 271 271 $symbol_repos[] = $repo; 272 272 273 273 $lang = last(explode('.', $drequest->getPath())); 274 274 $repo_languages = $repo->getSymbolLanguages(); 275 + $repo_languages = nonempty($repo_languages, array()); 275 276 $repo_languages = array_fill_keys($repo_languages, true); 276 - if (empty($repo_languages) || isset($repo_languages[$lang])) { 277 + 278 + $needs_symbols = true; 279 + if ($repo_languages && $symbol_repos) { 280 + $have_symbols = id(new DiffusionSymbolQuery()) 281 + ->existsSymbolsInRepository($repo->getPHID()); 282 + if (!$have_symbols) { 283 + $needs_symbols = false; 284 + } 285 + } 286 + 287 + if ($needs_symbols && $repo_languages) { 288 + $needs_symbols = isset($repo_languages[$lang]); 289 + } 290 + 291 + if ($needs_symbols) { 277 292 Javelin::initBehavior( 278 293 'repository-crossreference', 279 294 array(
+20
src/applications/diffusion/query/DiffusionSymbolQuery.php
··· 113 113 } 114 114 115 115 116 + /* -( Specialized Query )-------------------------------------------------- */ 117 + 118 + public function existsSymbolsInRepository($repository_phid) { 119 + $this 120 + ->withRepositoryPHIDs(array($repository_phid)) 121 + ->setLimit(1); 122 + 123 + $symbol = new PhabricatorRepositorySymbol(); 124 + $conn_r = $symbol->establishConnection('r'); 125 + 126 + $data = queryfx_all( 127 + $conn_r, 128 + 'SELECT * FROM %T %Q %Q', 129 + $symbol->getTableName(), 130 + $this->buildWhereClause($conn_r), 131 + $this->buildLimitClause($conn_r)); 132 + 133 + return (!empty($data)); 134 + } 135 + 116 136 /* -( Executing the Query )------------------------------------------------ */ 117 137 118 138