mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 02:31:10 +01:00
Add a preference for always using unified diffs
Summary: Ref T2009. These aren't good enough to actually use so I won't land this yet, but it makes testing changes a lot easier. Test Plan: - Swapped setting. - Loaded revisions. - Saw setting respected. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2009 Differential Revision: https://secure.phabricator.com/D11972
This commit is contained in:
parent
c82066408d
commit
33d7034276
7 changed files with 56 additions and 24 deletions
|
@ -360,7 +360,7 @@ return array(
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '82439934',
|
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '82439934',
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
||||||
'rsrc/js/application/differential/ChangesetViewManager.js' => '5eb5b98c',
|
'rsrc/js/application/differential/ChangesetViewManager.js' => 'c024db3d',
|
||||||
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'f2441746',
|
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'f2441746',
|
||||||
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18',
|
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18',
|
||||||
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
|
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
|
||||||
|
@ -510,7 +510,7 @@ return array(
|
||||||
'aphront-two-column-view-css' => '16ab3ad2',
|
'aphront-two-column-view-css' => '16ab3ad2',
|
||||||
'aphront-typeahead-control-css' => '0e403212',
|
'aphront-typeahead-control-css' => '0e403212',
|
||||||
'auth-css' => '1e655982',
|
'auth-css' => '1e655982',
|
||||||
'changeset-view-manager' => '5eb5b98c',
|
'changeset-view-manager' => 'c024db3d',
|
||||||
'config-options-css' => '7fedf08b',
|
'config-options-css' => '7fedf08b',
|
||||||
'config-welcome-css' => '6abd79be',
|
'config-welcome-css' => '6abd79be',
|
||||||
'conpherence-durable-column-view' => '3b836442',
|
'conpherence-durable-column-view' => '3b836442',
|
||||||
|
@ -1180,16 +1180,6 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'javelin-vector',
|
'javelin-vector',
|
||||||
),
|
),
|
||||||
'5eb5b98c' => array(
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-util',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-install',
|
|
||||||
'javelin-workflow',
|
|
||||||
'javelin-router',
|
|
||||||
'javelin-behavior-device',
|
|
||||||
'javelin-vector',
|
|
||||||
),
|
|
||||||
'5fefb143' => array(
|
'5fefb143' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -1714,6 +1704,16 @@ return array(
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
'phabricator-shaped-request',
|
'phabricator-shaped-request',
|
||||||
),
|
),
|
||||||
|
'c024db3d' => array(
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-util',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-install',
|
||||||
|
'javelin-workflow',
|
||||||
|
'javelin-router',
|
||||||
|
'javelin-behavior-device',
|
||||||
|
'javelin-vector',
|
||||||
|
),
|
||||||
'c1700f6f' => array(
|
'c1700f6f' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
|
|
|
@ -240,10 +240,11 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
||||||
// undergoing like six kinds of refactoring anyway.
|
// undergoing like six kinds of refactoring anyway.
|
||||||
$output = phutil_safe_html($output);
|
$output = phutil_safe_html($output);
|
||||||
|
|
||||||
$detail = new DifferentialChangesetDetailView();
|
$detail = id(new DifferentialChangesetDetailView())
|
||||||
$detail->setChangeset($changeset);
|
->setUser($this->getViewer())
|
||||||
$detail->appendChild($output);
|
->setChangeset($changeset)
|
||||||
$detail->setVsChangesetID($left_source);
|
->appendChild($output)
|
||||||
|
->setVsChangesetID($left_source);
|
||||||
|
|
||||||
$panel = new DifferentialPrimaryPaneView();
|
$panel = new DifferentialPrimaryPaneView();
|
||||||
$panel->appendChild(
|
$panel->appendChild(
|
||||||
|
|
|
@ -188,6 +188,19 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||||
$icon = id(new PHUIIconView())
|
$icon = id(new PHUIIconView())
|
||||||
->setIconFont($display_icon);
|
->setIconFont($display_icon);
|
||||||
|
|
||||||
|
$renderer = null;
|
||||||
|
|
||||||
|
// If the viewer prefers unified diffs, always set the renderer to unified.
|
||||||
|
// Otherwise, we leave it unspecified and the client will choose a
|
||||||
|
// renderer based on the screen size.
|
||||||
|
|
||||||
|
$viewer = $this->getUser();
|
||||||
|
$prefs = $viewer->loadPreferences();
|
||||||
|
$pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED;
|
||||||
|
if ($prefs->getPreference($pref_unified) == 'unified') {
|
||||||
|
$renderer = '1up';
|
||||||
|
}
|
||||||
|
|
||||||
return javelin_tag(
|
return javelin_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
|
@ -200,7 +213,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||||
'renderURI' => $this->getRenderURI(),
|
'renderURI' => $this->getRenderURI(),
|
||||||
'whitespace' => $this->getWhitespace(),
|
'whitespace' => $this->getWhitespace(),
|
||||||
'highlight' => null,
|
'highlight' => null,
|
||||||
'renderer' => null,
|
'renderer' => $renderer,
|
||||||
'ref' => $this->getRenderingRef(),
|
'ref' => $this->getRenderingRef(),
|
||||||
'autoload' => $this->getAutoload(),
|
'autoload' => $this->getAutoload(),
|
||||||
),
|
),
|
||||||
|
|
|
@ -130,7 +130,7 @@ final class DifferentialChangesetListView extends AphrontView {
|
||||||
'Configure Editor' => pht('Configure Editor'),
|
'Configure Editor' => pht('Configure Editor'),
|
||||||
'Load Changes' => pht('Load Changes'),
|
'Load Changes' => pht('Load Changes'),
|
||||||
'View Side-by-Side' => pht('View Side-by-Side'),
|
'View Side-by-Side' => pht('View Side-by-Side'),
|
||||||
'View Unified' => pht('View Unified (Barely Works!)'),
|
'View Unified' => pht('View Unified'),
|
||||||
'Change Text Encoding...' => pht('Change Text Encoding...'),
|
'Change Text Encoding...' => pht('Change Text Encoding...'),
|
||||||
'Highlight As...' => pht('Highlight As...'),
|
'Highlight As...' => pht('Highlight As...'),
|
||||||
),
|
),
|
||||||
|
@ -148,7 +148,8 @@ final class DifferentialChangesetListView extends AphrontView {
|
||||||
|
|
||||||
$ref = $this->references[$key];
|
$ref = $this->references[$key];
|
||||||
|
|
||||||
$detail = new DifferentialChangesetDetailView();
|
$detail = id(new DifferentialChangesetDetailView())
|
||||||
|
->setUser($this->getUser());
|
||||||
|
|
||||||
$uniq_id = 'diff-'.$changeset->getAnchorName();
|
$uniq_id = 'diff-'.$changeset->getAnchorName();
|
||||||
$detail->setID($uniq_id);
|
$detail->setID($uniq_id);
|
||||||
|
|
|
@ -19,6 +19,7 @@ final class PhabricatorDiffPreferencesSettingsPanel
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$preferences = $user->loadPreferences();
|
$preferences = $user->loadPreferences();
|
||||||
|
|
||||||
|
$pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED;
|
||||||
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
|
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
|
@ -32,6 +33,9 @@ final class PhabricatorDiffPreferencesSettingsPanel
|
||||||
|
|
||||||
$preferences->setPreference($pref_filetree, $filetree);
|
$preferences->setPreference($pref_filetree, $filetree);
|
||||||
|
|
||||||
|
$unified = $request->getStr($pref_unified);
|
||||||
|
$preferences->setPreference($pref_unified, $unified);
|
||||||
|
|
||||||
$preferences->save();
|
$preferences->save();
|
||||||
return id(new AphrontRedirectResponse())
|
return id(new AphrontRedirectResponse())
|
||||||
->setURI($this->getPanelURI('?saved=true'));
|
->setURI($this->getPanelURI('?saved=true'));
|
||||||
|
@ -39,6 +43,23 @@ final class PhabricatorDiffPreferencesSettingsPanel
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
->appendRemarkupInstructions(
|
||||||
|
pht(
|
||||||
|
'Phabricator normally shows diffs in a side-by-side layout on '.
|
||||||
|
'large screens, and automatically switches to a unified '.
|
||||||
|
'view on small screens (like mobile phones). If you prefer '.
|
||||||
|
'unified diffs even on large screens, you can select them as '.
|
||||||
|
'the default layout.'))
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormSelectControl())
|
||||||
|
->setLabel(pht('Show Unified Diffs'))
|
||||||
|
->setName($pref_unified)
|
||||||
|
->setValue($preferences->getPreference($pref_unified))
|
||||||
|
->setOptions(
|
||||||
|
array(
|
||||||
|
'default' => pht('On Small Screens'),
|
||||||
|
'unified' => pht('Always'),
|
||||||
|
)))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSelectControl())
|
id(new AphrontFormSelectControl())
|
||||||
->setLabel(pht('Show Filetree'))
|
->setLabel(pht('Show Filetree'))
|
||||||
|
|
|
@ -28,6 +28,7 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
|
||||||
const PREFERENCE_APP_TILES = 'app-tiles';
|
const PREFERENCE_APP_TILES = 'app-tiles';
|
||||||
const PREFERENCE_APP_PINNED = 'app-pinned';
|
const PREFERENCE_APP_PINNED = 'app-pinned';
|
||||||
|
|
||||||
|
const PREFERENCE_DIFF_UNIFIED = 'diff-unified';
|
||||||
const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
|
const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
|
||||||
|
|
||||||
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
|
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
|
||||||
|
|
|
@ -172,17 +172,12 @@ JX.install('ChangesetViewManager', {
|
||||||
return this._renderer;
|
return this._renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is a big pile of TODOs.
|
|
||||||
|
|
||||||
// NOTE: If you load the page at one device resolution and then resize to
|
// NOTE: If you load the page at one device resolution and then resize to
|
||||||
// a different one we don't re-render the diffs, because it's a
|
// a different one we don't re-render the diffs, because it's a
|
||||||
// complicated mess and you could lose inline comments, cursor positions,
|
// complicated mess and you could lose inline comments, cursor positions,
|
||||||
// etc.
|
// etc.
|
||||||
var renderer = (JX.Device.getDevice() == 'desktop') ? '2up' : '1up';
|
var renderer = (JX.Device.getDevice() == 'desktop') ? '2up' : '1up';
|
||||||
|
|
||||||
// TODO: Once 1up works better, figure out when to show it.
|
|
||||||
renderer = '2up';
|
|
||||||
|
|
||||||
return renderer;
|
return renderer;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue