mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 18:51:12 +01:00
Separate external editor integration from callsigns
Summary: Ref T4245. Pass the whole repository in so it can do something else in a future change. Test Plan: Loaded changesets in Diffusion. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4245 Differential Revision: https://secure.phabricator.com/D14931
This commit is contained in:
parent
b1388c5ca1
commit
be5b89687e
5 changed files with 15 additions and 15 deletions
|
@ -64,7 +64,7 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
|
|||
$line .= ' called at ['.$entry['file'].':'.$entry['line'].']';
|
||||
try {
|
||||
$user = $this->getRequest()->getUser();
|
||||
$href = $user->loadEditorLink($entry['file'], $entry['line'], '');
|
||||
$href = $user->loadEditorLink($entry['file'], $entry['line'], null);
|
||||
} catch (Exception $ex) {
|
||||
// The database can be inaccessible.
|
||||
}
|
||||
|
|
|
@ -314,8 +314,7 @@ final class DifferentialChangesetListView extends AphrontView {
|
|||
$changeset->getAbsoluteRepositoryPath($repository, $this->diff),
|
||||
'/');
|
||||
$line = idx($changeset->getMetadata(), 'line:first', 1);
|
||||
$callsign = $repository->getCallsign();
|
||||
$editor_link = $user->loadEditorLink($path, $line, $callsign);
|
||||
$editor_link = $user->loadEditorLink($path, $line, $repository);
|
||||
if ($editor_link) {
|
||||
$meta['editor'] = $editor_link;
|
||||
} else {
|
||||
|
|
|
@ -435,9 +435,8 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
$path = $drequest->getPath();
|
||||
$line = nonempty((int)$drequest->getLine(), 1);
|
||||
|
||||
$callsign = $repository->getCallsign();
|
||||
$editor_link = $user->loadEditorLink($path, $line, $callsign);
|
||||
$template = $user->loadEditorLink($path, '%l', $callsign);
|
||||
$editor_link = $user->loadEditorLink($path, $line, $repository);
|
||||
$template = $user->loadEditorLink($path, '%l', $repository);
|
||||
|
||||
$icon_edit = id(new PHUIIconView())
|
||||
->setIconFont('fa-pencil');
|
||||
|
|
|
@ -504,7 +504,11 @@ final class PhabricatorUser
|
|||
return $preferences;
|
||||
}
|
||||
|
||||
public function loadEditorLink($path, $line, $callsign) {
|
||||
public function loadEditorLink(
|
||||
$path,
|
||||
$line,
|
||||
PhabricatorRepository $repository = null) {
|
||||
|
||||
$editor = $this->loadPreferences()->getPreference(
|
||||
PhabricatorUserPreferences::PREFERENCE_EDITOR);
|
||||
|
||||
|
@ -524,6 +528,12 @@ final class PhabricatorUser
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($repository) {
|
||||
$callsign = $repository->getCallsign();
|
||||
} else {
|
||||
$callsign = null;
|
||||
}
|
||||
|
||||
$uri = strtr($editor, array(
|
||||
'%%' => '%',
|
||||
'%f' => phutil_escape_uri($path),
|
||||
|
|
|
@ -50,14 +50,6 @@ final class AphrontStackTraceView extends AphrontView {
|
|||
if ($file) {
|
||||
if (isset($callsigns[$lib])) {
|
||||
$attrs = array('title' => $file);
|
||||
try {
|
||||
$attrs['href'] = $user->loadEditorLink(
|
||||
'/src/'.$relative,
|
||||
$part['line'],
|
||||
$callsigns[$lib]);
|
||||
} catch (Exception $ex) {
|
||||
// The database can be inaccessible.
|
||||
}
|
||||
if (empty($attrs['href'])) {
|
||||
$attrs['href'] = sprintf($path, $callsigns[$lib]).
|
||||
str_replace(DIRECTORY_SEPARATOR, '/', $relative).
|
||||
|
|
Loading…
Reference in a new issue