@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+56 -24
+12 -12
resources/celerity/map.php
··· 360 360 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '82439934', 361 361 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 362 362 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 363 - 'rsrc/js/application/differential/ChangesetViewManager.js' => '5eb5b98c', 363 + 'rsrc/js/application/differential/ChangesetViewManager.js' => 'c024db3d', 364 364 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'f2441746', 365 365 'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18', 366 366 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', ··· 510 510 'aphront-two-column-view-css' => '16ab3ad2', 511 511 'aphront-typeahead-control-css' => '0e403212', 512 512 'auth-css' => '1e655982', 513 - 'changeset-view-manager' => '5eb5b98c', 513 + 'changeset-view-manager' => 'c024db3d', 514 514 'config-options-css' => '7fedf08b', 515 515 'config-welcome-css' => '6abd79be', 516 516 'conpherence-durable-column-view' => '3b836442', ··· 1180 1180 'javelin-dom', 1181 1181 'javelin-vector', 1182 1182 ), 1183 - '5eb5b98c' => array( 1184 - 'javelin-dom', 1185 - 'javelin-util', 1186 - 'javelin-stratcom', 1187 - 'javelin-install', 1188 - 'javelin-workflow', 1189 - 'javelin-router', 1190 - 'javelin-behavior-device', 1191 - 'javelin-vector', 1192 - ), 1193 1183 '5fefb143' => array( 1194 1184 'javelin-behavior', 1195 1185 'javelin-dom', ··· 1713 1703 'javelin-dom', 1714 1704 'javelin-util', 1715 1705 'phabricator-shaped-request', 1706 + ), 1707 + 'c024db3d' => array( 1708 + 'javelin-dom', 1709 + 'javelin-util', 1710 + 'javelin-stratcom', 1711 + 'javelin-install', 1712 + 'javelin-workflow', 1713 + 'javelin-router', 1714 + 'javelin-behavior-device', 1715 + 'javelin-vector', 1716 1716 ), 1717 1717 'c1700f6f' => array( 1718 1718 'javelin-install',
+5 -4
src/applications/differential/controller/DifferentialChangesetViewController.php
··· 240 240 // undergoing like six kinds of refactoring anyway. 241 241 $output = phutil_safe_html($output); 242 242 243 - $detail = new DifferentialChangesetDetailView(); 244 - $detail->setChangeset($changeset); 245 - $detail->appendChild($output); 246 - $detail->setVsChangesetID($left_source); 243 + $detail = id(new DifferentialChangesetDetailView()) 244 + ->setUser($this->getViewer()) 245 + ->setChangeset($changeset) 246 + ->appendChild($output) 247 + ->setVsChangesetID($left_source); 247 248 248 249 $panel = new DifferentialPrimaryPaneView(); 249 250 $panel->appendChild(
+14 -1
src/applications/differential/view/DifferentialChangesetDetailView.php
··· 188 188 $icon = id(new PHUIIconView()) 189 189 ->setIconFont($display_icon); 190 190 191 + $renderer = null; 192 + 193 + // If the viewer prefers unified diffs, always set the renderer to unified. 194 + // Otherwise, we leave it unspecified and the client will choose a 195 + // renderer based on the screen size. 196 + 197 + $viewer = $this->getUser(); 198 + $prefs = $viewer->loadPreferences(); 199 + $pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED; 200 + if ($prefs->getPreference($pref_unified) == 'unified') { 201 + $renderer = '1up'; 202 + } 203 + 191 204 return javelin_tag( 192 205 'div', 193 206 array( ··· 200 213 'renderURI' => $this->getRenderURI(), 201 214 'whitespace' => $this->getWhitespace(), 202 215 'highlight' => null, 203 - 'renderer' => null, 216 + 'renderer' => $renderer, 204 217 'ref' => $this->getRenderingRef(), 205 218 'autoload' => $this->getAutoload(), 206 219 ),
+3 -2
src/applications/differential/view/DifferentialChangesetListView.php
··· 130 130 'Configure Editor' => pht('Configure Editor'), 131 131 'Load Changes' => pht('Load Changes'), 132 132 'View Side-by-Side' => pht('View Side-by-Side'), 133 - 'View Unified' => pht('View Unified (Barely Works!)'), 133 + 'View Unified' => pht('View Unified'), 134 134 'Change Text Encoding...' => pht('Change Text Encoding...'), 135 135 'Highlight As...' => pht('Highlight As...'), 136 136 ), ··· 148 148 149 149 $ref = $this->references[$key]; 150 150 151 - $detail = new DifferentialChangesetDetailView(); 151 + $detail = id(new DifferentialChangesetDetailView()) 152 + ->setUser($this->getUser()); 152 153 153 154 $uniq_id = 'diff-'.$changeset->getAnchorName(); 154 155 $detail->setID($uniq_id);
+21
src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
··· 19 19 $user = $request->getUser(); 20 20 $preferences = $user->loadPreferences(); 21 21 22 + $pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED; 22 23 $pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE; 23 24 24 25 if ($request->isFormPost()) { ··· 32 33 33 34 $preferences->setPreference($pref_filetree, $filetree); 34 35 36 + $unified = $request->getStr($pref_unified); 37 + $preferences->setPreference($pref_unified, $unified); 38 + 35 39 $preferences->save(); 36 40 return id(new AphrontRedirectResponse()) 37 41 ->setURI($this->getPanelURI('?saved=true')); ··· 39 43 40 44 $form = id(new AphrontFormView()) 41 45 ->setUser($user) 46 + ->appendRemarkupInstructions( 47 + pht( 48 + 'Phabricator normally shows diffs in a side-by-side layout on '. 49 + 'large screens, and automatically switches to a unified '. 50 + 'view on small screens (like mobile phones). If you prefer '. 51 + 'unified diffs even on large screens, you can select them as '. 52 + 'the default layout.')) 53 + ->appendChild( 54 + id(new AphrontFormSelectControl()) 55 + ->setLabel(pht('Show Unified Diffs')) 56 + ->setName($pref_unified) 57 + ->setValue($preferences->getPreference($pref_unified)) 58 + ->setOptions( 59 + array( 60 + 'default' => pht('On Small Screens'), 61 + 'unified' => pht('Always'), 62 + ))) 42 63 ->appendChild( 43 64 id(new AphrontFormSelectControl()) 44 65 ->setLabel(pht('Show Filetree'))
+1
src/applications/settings/storage/PhabricatorUserPreferences.php
··· 28 28 const PREFERENCE_APP_TILES = 'app-tiles'; 29 29 const PREFERENCE_APP_PINNED = 'app-pinned'; 30 30 31 + const PREFERENCE_DIFF_UNIFIED = 'diff-unified'; 31 32 const PREFERENCE_DIFF_FILETREE = 'diff-filetree'; 32 33 33 34 const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
-5
webroot/rsrc/js/application/differential/ChangesetViewManager.js
··· 172 172 return this._renderer; 173 173 } 174 174 175 - // TODO: This is a big pile of TODOs. 176 - 177 175 // NOTE: If you load the page at one device resolution and then resize to 178 176 // a different one we don't re-render the diffs, because it's a 179 177 // complicated mess and you could lose inline comments, cursor positions, 180 178 // etc. 181 179 var renderer = (JX.Device.getDevice() == 'desktop') ? '2up' : '1up'; 182 - 183 - // TODO: Once 1up works better, figure out when to show it. 184 - renderer = '2up'; 185 180 186 181 return renderer; 187 182 },