1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Fix an issue with symbol lookup identifying path names in Diffusion

Summary:
Depends on D18939. Ref T13047. Symbol lookup can be activated from a diff (in Differential or Diffusion) or from the static view of a file at a particular commit.

In the latter case, we need to figure out the path a little differently. The character and line number approaches still work as written.

Test Plan:
  - Command-clicked symbols in the Diffusion browse view with blame on and off; saw path, line and char populate properly.
  - Command-clicked symbols in Differential diff view to check I didn't break anything.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13047

Differential Revision: https://secure.phabricator.com/D18940
This commit is contained in:
epriestley 2018-01-26 06:42:16 -08:00
parent fdc36677ba
commit ad7755d9a9
3 changed files with 35 additions and 14 deletions

View file

@ -13,7 +13,7 @@ return array(
'core.pkg.js' => '4c79d74f',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '45951e9e',
'differential.pkg.js' => 'b69ae3ec',
'differential.pkg.js' => '19ee9979',
'diffusion.pkg.css' => 'a2d17c7d',
'diffusion.pkg.js' => '6134c5a1',
'favicon.ico' => '30672e08',
@ -443,7 +443,7 @@ return array(
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
'rsrc/js/application/releeph/releeph-request-state-change.js' => 'a0b57eb8',
'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'de2e896f',
'rsrc/js/application/repository/repository-crossreference.js' => 'fc2d8ffd',
'rsrc/js/application/repository/repository-crossreference.js' => '2ab10a76',
'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e2e0a072',
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f',
@ -692,7 +692,7 @@ return array(
'javelin-behavior-reorder-applications' => '76b9fc3e',
'javelin-behavior-reorder-columns' => 'e1d25dfb',
'javelin-behavior-reorder-profile-menu-items' => 'e2e0a072',
'javelin-behavior-repository-crossreference' => 'fc2d8ffd',
'javelin-behavior-repository-crossreference' => '2ab10a76',
'javelin-behavior-scrollbar' => '834a1173',
'javelin-behavior-search-reorder-queries' => 'e9581f08',
'javelin-behavior-select-content' => 'bf5374ef',
@ -1088,6 +1088,12 @@ return array(
'javelin-install',
'javelin-util',
),
'2ab10a76' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'2ae077e1' => array(
'javelin-behavior',
'javelin-dom',
@ -2159,12 +2165,6 @@ return array(
'javelin-install',
'javelin-dom',
),
'fc2d8ffd' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'fc91ab6c' => array(
'javelin-behavior',
'javelin-dom',

View file

@ -658,6 +658,11 @@ final class DiffusionBrowseController extends DiffusionController {
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($corpus)
->addClass('diffusion-mobile-view')
->addSigil('diffusion-file-content-view')
->setMetadata(
array(
'path' => $this->getDiffusionRequest()->getPath(),
))
->setCollapsed(true);
$messages = array();

View file

@ -94,12 +94,15 @@ JX.behavior('repository-crossreference', function(config, statics) {
};
var c = target.className;
c = c.replace(classHighlight, '').trim();
if (class_map[c]) {
query.type = class_map[c];
}
if (target.hasAttribute('data-symbol-context')) {
query.context = target.getAttribute('data-symbol-context');
}
if (target.hasAttribute('data-symbol-name')) {
symbol = target.getAttribute('data-symbol-name');
}
@ -176,13 +179,26 @@ JX.behavior('repository-crossreference', function(config, statics) {
}
function getPath(target) {
var changeset = JX.DOM.findAbove(target, 'div', 'differential-changeset');
if (!changeset) {
return null;
// This method works in Differential, when browsing a changset.
var changeset;
try {
changeset = JX.DOM.findAbove(target, 'div', 'differential-changeset');
return JX.Stratcom.getData(changeset).path;
} catch (ex) {
// Ignore.
}
return JX.Stratcom.getData(changeset).path;
// This method works in Diffusion, when viewing the content of a file at
// a particular commit.
var file;
try {
file = JX.DOM.findAbove(target, 'div', 'diffusion-file-content-view');
return JX.Stratcom.getData(file).path;
} catch (ex) {
// Ignore.
}
return null;
}
function getChar(target) {