Differential D21282 Diff 50680 src/applications/differential/view/DifferentialChangesetDetailView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/view/DifferentialChangesetDetailView.php
Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | return javelin_tag( | ||||
'icon' => $display_icon, | 'icon' => $display_icon, | ||||
'pathParts' => $path_parts, | 'pathParts' => $path_parts, | ||||
'pathIconIcon' => $changeset->getPathIconIcon(), | 'pathIconIcon' => $changeset->getPathIconIcon(), | ||||
'pathIconColor' => $changeset->getPathIconColor(), | 'pathIconColor' => $changeset->getPathIconColor(), | ||||
'isLowImportance' => $changeset->getIsLowImportanceChangeset(), | 'isLowImportance' => $changeset->getIsLowImportanceChangeset(), | ||||
'isOwned' => $changeset->getIsOwnedChangeset(), | 'isOwned' => $changeset->getIsOwnedChangeset(), | ||||
'editorURI' => $this->getEditorURI(), | 'editorURITemplate' => $this->getEditorURITemplate(), | ||||
'editorConfigureURI' => $this->getEditorConfigureURI(), | 'editorConfigureURI' => $this->getEditorConfigureURI(), | ||||
'loaded' => $is_loaded, | 'loaded' => $is_loaded, | ||||
'changesetState' => $changeset_state, | 'changesetState' => $changeset_state, | ||||
'showPathURI' => $show_path_uri, | 'showPathURI' => $show_path_uri, | ||||
'showDirectoryURI' => $show_directory_uri, | 'showDirectoryURI' => $show_directory_uri, | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | public function setDiff(DifferentialDiff $diff) { | ||||
$this->diff = $diff; | $this->diff = $diff; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDiff() { | public function getDiff() { | ||||
return $this->diff; | return $this->diff; | ||||
} | } | ||||
private function getEditorURI() { | private function getEditorURITemplate() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
if (!$repository) { | if (!$repository) { | ||||
return null; | return null; | ||||
} | } | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$link_engine = PhabricatorEditorURIEngine::newForViewer($viewer); | $link_engine = PhabricatorEditorURIEngine::newForViewer($viewer); | ||||
if (!$link_engine) { | if (!$link_engine) { | ||||
return null; | return null; | ||||
} | } | ||||
$link_engine->setRepository($repository); | $link_engine->setRepository($repository); | ||||
$changeset = $this->getChangeset(); | $changeset = $this->getChangeset(); | ||||
$diff = $this->getDiff(); | $diff = $this->getDiff(); | ||||
$path = $changeset->getAbsoluteRepositoryPath($repository, $diff); | $path = $changeset->getAbsoluteRepositoryPath($repository, $diff); | ||||
$path = ltrim($path, '/'); | $path = ltrim($path, '/'); | ||||
$line = idx($changeset->getMetadata(), 'line:first', 1); | return $link_engine->getURITokensForPath($path); | ||||
return $link_engine->getURIForPath($path, $line); | |||||
} | } | ||||
private function getEditorConfigureURI() { | private function getEditorConfigureURI() { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
if (!$viewer->isLoggedIn()) { | if (!$viewer->isLoggedIn()) { | ||||
return null; | return null; | ||||
} | } | ||||
return '/settings/panel/editor/'; | return '/settings/panel/editor/'; | ||||
} | } | ||||
} | } |