Show cross-references in diffusion
Summary: We do this in differential. To do this in diffusion, we need to know the arcanist project (which I do by loading all possible projects for the repository) and the language. Test Plan: load a php file in diffusion to see crossreferences; load a text file and check darkconsole that it didn't try to crossreference. Reviewers: epriestley, vrana, jungejason Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3020
This commit is contained in:
@@ -210,6 +210,38 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
||||
$rows = $this->buildDisplayRows($text_list, $rev_list, $blame_dict,
|
||||
$needs_blame, $drequest, $file_query, $selected);
|
||||
|
||||
$id = celerity_generate_unique_node_id();
|
||||
|
||||
$projects = $drequest->loadArcanistProjects();
|
||||
$langs = array();
|
||||
foreach ($projects as $project) {
|
||||
$ls = $project->getSymbolIndexLanguages();
|
||||
if (!$ls) {
|
||||
continue;
|
||||
}
|
||||
$dep_projects = $project->getSymbolIndexProjects();
|
||||
$dep_projects = mpull($dep_projects, 'getPHID');
|
||||
$dep_projects[] = $project->getPHID();
|
||||
foreach ($ls as $lang) {
|
||||
if (!isset($langs[$lang])) {
|
||||
$langs[$lang] = array();
|
||||
}
|
||||
$langs[$lang] += $dep_projects + array($project);
|
||||
}
|
||||
}
|
||||
|
||||
$lang = last(explode('.', $drequest->getPath()));
|
||||
|
||||
if (isset($langs[$lang])) {
|
||||
Javelin::initBehavior(
|
||||
'repository-crossreference',
|
||||
array(
|
||||
'container' => $id,
|
||||
'lang' => $lang,
|
||||
'projects' => $langs[$lang],
|
||||
));
|
||||
}
|
||||
|
||||
$corpus_table = phutil_render_tag(
|
||||
'table',
|
||||
array(
|
||||
@@ -220,6 +252,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
||||
'div',
|
||||
array(
|
||||
'style' => 'padding: 0 2em;',
|
||||
'id' => $id,
|
||||
),
|
||||
$corpus_table);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user