Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14351005
D12946.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D12946.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -261,12 +261,11 @@
$repository = $revision->getRepository();
if ($repository) {
- list($symbol_indexes, $repository_phids) = $this->buildSymbolIndexes(
+ $symbol_indexes = $this->buildSymbolIndexes(
$repository,
$visible_changesets);
} else {
$symbol_indexes = array();
- $repository_phids = null;
}
$revision_detail->setActions($actions);
@@ -306,15 +305,6 @@
),
$comment_view);
- if ($repository) {
- Javelin::initBehavior(
- 'repository-crossreference',
- array(
- 'section' => $wrap_id,
- 'repositories' => $repository_phids,
- ));
- }
-
$changeset_view = new DifferentialChangesetListView();
$changeset_view->setChangesets($changesets);
$changeset_view->setVisibleChangesets($visible_changesets);
@@ -758,11 +748,22 @@
$langs = $repository->getSymbolLanguages();
$langs = nonempty($langs, array());
+ $sources = $repository->getSymbolSources();
+ $sources = nonempty($sources, array());
+
$symbol_indexes = array();
+ if ($langs && $sources) {
+ $have_symbols = id(new DiffusionSymbolQuery())
+ ->existsSymbolsInRepository($repository->getPHID());
+ if (!$have_symbols) {
+ return $symbol_indexes;
+ }
+ }
+
$repository_phids = array_merge(
array($repository->getPHID()),
- nonempty($repository->getSymbolSources(), array()));
+ $sources);
$indexed_langs = array_fill_keys($langs, true);
foreach ($visible_changesets as $key => $changeset) {
@@ -775,7 +776,7 @@
}
}
- return array($symbol_indexes, $repository_phids);
+ return $symbol_indexes;
}
private function loadOtherRevisions(
diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php
@@ -267,13 +267,28 @@
$id = celerity_generate_unique_node_id();
$repo = $drequest->getRepository();
- $symbol_repos = $repo->getSymbolSources();
+ $symbol_repos = nonempty($repo->getSymbolSources(), array());
$symbol_repos[] = $repo;
$lang = last(explode('.', $drequest->getPath()));
$repo_languages = $repo->getSymbolLanguages();
+ $repo_languages = nonempty($repo_languages, array());
$repo_languages = array_fill_keys($repo_languages, true);
- if (empty($repo_languages) || isset($repo_languages[$lang])) {
+
+ $needs_symbols = true;
+ if ($repo_languages && $symbol_repos) {
+ $have_symbols = id(new DiffusionSymbolQuery())
+ ->existsSymbolsInRepository($repo->getPHID());
+ if (!$have_symbols) {
+ $needs_symbols = false;
+ }
+ }
+
+ if ($needs_symbols && $repo_languages) {
+ $needs_symbols = isset($repo_languages[$lang]);
+ }
+
+ if ($needs_symbols) {
Javelin::initBehavior(
'repository-crossreference',
array(
diff --git a/src/applications/diffusion/query/DiffusionSymbolQuery.php b/src/applications/diffusion/query/DiffusionSymbolQuery.php
--- a/src/applications/diffusion/query/DiffusionSymbolQuery.php
+++ b/src/applications/diffusion/query/DiffusionSymbolQuery.php
@@ -113,6 +113,26 @@
}
+/* -( Specialized Query )-------------------------------------------------- */
+
+ public function existsSymbolsInRepository($repository_phid) {
+ $this
+ ->withRepositoryPHIDs(array($repository_phid))
+ ->setLimit(1);
+
+ $symbol = new PhabricatorRepositorySymbol();
+ $conn_r = $symbol->establishConnection('r');
+
+ $data = queryfx_all(
+ $conn_r,
+ 'SELECT * FROM %T %Q %Q',
+ $symbol->getTableName(),
+ $this->buildWhereClause($conn_r),
+ $this->buildLimitClause($conn_r));
+
+ return (!empty($data));
+ }
+
/* -( Executing the Query )------------------------------------------------ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 7:13 AM (20 h, 59 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6909809
Default Alt Text
D12946.diff (4 KB)
Attached To
Mode
D12946: Only link symbols if there might be any
Attached
Detach File
Event Timeline
Log In to Comment