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

Fix history link in Diffusion non-root browse views

Summary:
Fixes T9798. That task has good repro instructions.

In sub-views, we don't link the "History" icon correctly -- we only link it to `history/README` instead of `history/path/to/README`. Add the full path.

Also canonicalize the paths in a slightly prettier and more consistenty way.

Test Plan: Viewed root and non-root browse tables, saw links show up properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9798

Differential Revision: https://secure.phabricator.com/D14491
This commit is contained in:
epriestley 2015-11-16 08:32:38 -08:00
parent 1a84a2fe4b
commit 5963c4c9e0

View file

@ -30,8 +30,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
$rows = array();
$show_edit = false;
foreach ($this->paths as $path) {
$history_link = $this->linkHistory($path->getPath());
$full_path = $base_path.$path->getPath();
$dir_slash = null;
$file_type = $path->getFileType();
@ -40,11 +39,13 @@ final class DiffusionBrowseTableView extends DiffusionView {
$dir_slash = '/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse(
$base_path.$path->getPath().$dir_slash,
$full_path.$dir_slash,
array(
'type' => $file_type,
'name' => $browse_text,
)));
$history_path = $full_path.'/';
} else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) {
$browse_text = $path->getPath().'/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse(
@ -55,16 +56,22 @@ final class DiffusionBrowseTableView extends DiffusionView {
'hash' => $path->getHash(),
'external' => $path->getExternalURI(),
)));
$history_path = $full_path.'/';
} else {
$browse_text = $path->getPath();
$browse_link = $this->linkBrowse(
$base_path.$path->getPath(),
$full_path,
array(
'type' => $file_type,
'name' => $browse_text,
));
$history_path = $full_path;
}
$history_link = $this->linkHistory($history_path);
$dict = array(
'lint' => celerity_generate_unique_node_id(),
'commit' => celerity_generate_unique_node_id(),
@ -73,7 +80,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
'details' => celerity_generate_unique_node_id(),
);
$need_pull[$base_path.$path->getPath().$dir_slash] = $dict;
$need_pull[$full_path.$dir_slash] = $dict;
foreach ($dict as $k => $uniq) {
$dict[$k] = phutil_tag('span', array('id' => $uniq), '');
}