@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.

Modernize Diffusion "change" view

Summary:
- Kicks it out to full width.
- More useful header/crumbs/properties/actions (needs some more work).
- Works for public repositories.
- Fix a bug where the "rX" crumb would lose the branch you're on.

Test Plan: See screenshot.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7063

+108 -19
+7 -3
src/applications/differential/view/DifferentialChangesetListView.php
··· 194 194 )); 195 195 } 196 196 197 + $header = null; 198 + if ($this->getTitle() !== null) { 199 + $header = id(new PHUIHeaderView()) 200 + ->setHeader($this->getTitle()); 201 + } 202 + 197 203 return array( 198 - id(new PHUIHeaderView()) 199 - ->setHeader($this->getTitle()) 200 - ->render(), 204 + $header, 201 205 phutil_tag( 202 206 'div', 203 207 array(
+1 -1
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 65 65 66 66 $header = id(new PHUIHeaderView()) 67 67 ->setUser($viewer) 68 - ->setHeader($this->renderPathLinks($drequest)) 68 + ->setHeader($this->renderPathLinks($drequest, 'browse')) 69 69 ->setPolicyObject($drequest->getRepository()); 70 70 71 71 return $header;
+86 -9
src/applications/diffusion/controller/DiffusionChangeController.php
··· 2 2 3 3 final class DiffusionChangeController extends DiffusionController { 4 4 5 + public function shouldAllowPublic() { 6 + return true; 7 + } 8 + 5 9 public function processRequest() { 6 10 $drequest = $this->diffusionRequest; 11 + $viewer = $this->getRequest()->getUser(); 7 12 8 13 $content = array(); 9 14 ··· 11 16 'diffusion.diffquery', 12 17 array( 13 18 'commit' => $drequest->getCommit(), 14 - 'path' => $drequest->getPath())); 19 + 'path' => $drequest->getPath(), 20 + )); 15 21 $drequest->setCommit($data['effectiveCommit']); 16 22 $raw_changes = ArcanistDiffChange::newFromConduit($data['changes']); 17 23 $diff = DifferentialDiff::newFromRawChanges($raw_changes); ··· 31 37 ); 32 38 33 39 $changeset_view = new DifferentialChangesetListView(); 34 - $changeset_view->setTitle(DiffusionView::nameCommit($repository, $commit)); 35 40 $changeset_view->setChangesets($changesets); 36 41 $changeset_view->setVisibleChangesets($changesets); 37 42 $changeset_view->setRenderingReferences( ··· 45 50 'view' => 'raw', 46 51 ), 47 52 ); 53 + 48 54 $right_uri = $drequest->generateURI($raw_params); 49 55 $raw_params['params']['before'] = $drequest->getRawCommit(); 50 56 $left_uri = $drequest->generateURI($raw_params); 51 57 $changeset_view->setRawFileURIs($left_uri, $right_uri); 52 58 53 - $changeset_view->setRenderURI( 54 - '/diffusion/'.$callsign.'/diff/'); 59 + $changeset_view->setRenderURI('/diffusion/'.$callsign.'/diff/'); 55 60 $changeset_view->setWhitespace( 56 61 DifferentialChangesetParser::WHITESPACE_SHOW_ALL); 57 62 $changeset_view->setUser($this->getRequest()->getUser()); ··· 61 66 require_celerity_resource('differential-core-view-css'); 62 67 $content[] = $changeset_view->render(); 63 68 64 - $nav = $this->buildSideNav('change', true); 65 - $nav->appendChild($content); 66 69 $crumbs = $this->buildCrumbs( 67 70 array( 68 71 'branch' => true, 69 72 'path' => true, 70 73 'view' => 'change', 71 74 )); 72 - $nav->setCrumbs($crumbs); 75 + 76 + $links = $this->renderPathLinks($drequest); 77 + 78 + $header = id(new PHUIHeaderView()) 79 + ->setHeader($links) 80 + ->setUser($viewer) 81 + ->setPolicyObject($drequest->getRepository()); 82 + $actions = $this->buildActionView($drequest); 83 + $properties = $this->buildPropertyView($drequest); 73 84 74 85 return $this->buildApplicationPage( 75 - $nav, 86 + array( 87 + $crumbs, 88 + $header, 89 + $actions, 90 + $properties, 91 + $content, 92 + ), 76 93 array( 77 94 'title' => pht('Change'), 78 - 'device' => true, 95 + )); 96 + } 97 + 98 + private function buildActionView(DiffusionRequest $drequest) { 99 + $viewer = $this->getRequest()->getUser(); 100 + 101 + $view = id(new PhabricatorActionListView()) 102 + ->setUser($viewer); 103 + 104 + $history_uri = $drequest->generateURI( 105 + array( 106 + 'action' => 'history', 107 + )); 108 + 109 + $browse_uri = $drequest->generateURI( 110 + array( 111 + 'action' => 'browse', 79 112 )); 113 + 114 + $view->addAction( 115 + id(new PhabricatorActionView()) 116 + ->setName(pht('View History')) 117 + ->setHref($history_uri) 118 + ->setIcon('history')); 119 + 120 + $history_uri = $drequest->generateURI( 121 + array( 122 + 'action' => 'browse', 123 + )); 124 + 125 + $view->addAction( 126 + id(new PhabricatorActionView()) 127 + ->setName(pht('Browse Content')) 128 + ->setHref($browse_uri) 129 + ->setIcon('file')); 130 + 131 + return $view; 132 + } 133 + 134 + protected function buildPropertyView(DiffusionRequest $drequest) { 135 + $viewer = $this->getRequest()->getUser(); 136 + 137 + $view = id(new PhabricatorPropertyListView()) 138 + ->setUser($viewer); 139 + 140 + $stable_commit = $drequest->getStableCommitName(); 141 + $callsign = $drequest->getRepository()->getCallsign(); 142 + 143 + $view->addProperty( 144 + pht('Commit'), 145 + phutil_tag( 146 + 'a', 147 + array( 148 + 'href' => $drequest->generateURI( 149 + array( 150 + 'action' => 'commit', 151 + 'commit' => $stable_commit, 152 + )), 153 + ), 154 + $drequest->getRepository()->formatCommitName($stable_commit))); 155 + 156 + return $view; 80 157 } 81 158 82 159 }
+8 -5
src/applications/diffusion/controller/DiffusionController.php
··· 122 122 $crumb_list[] = $crumb; 123 123 return $crumb_list; 124 124 } 125 - $crumb->setHref("/diffusion/{$callsign}/"); 125 + $crumb->setHref( 126 + $drequest->generateURI( 127 + array( 128 + 'action' => 'branch', 129 + 'path' => '/', 130 + ))); 126 131 $crumb_list[] = $crumb; 127 132 128 133 $raw_commit = $drequest->getRawCommit(); ··· 187 192 break; 188 193 case 'change': 189 194 $view_name = pht('Change'); 190 - $crumb_list[] = $crumb->setName( 191 - hsprintf('%s (%s)', $path, $commit_link)); 192 - return $crumb_list; 195 + break; 193 196 } 194 197 195 198 $uri_params = array( ··· 199 202 $crumb = id(new PhabricatorCrumbView()) 200 203 ->setName($view_name); 201 204 202 - if ($view == 'browse') { 205 + if ($view == 'browse' || $view == 'change') { 203 206 $crumb_list[] = $crumb; 204 207 return $crumb_list; 205 208 }
+4
src/applications/diffusion/controller/DiffusionDiffController.php
··· 2 2 3 3 final class DiffusionDiffController extends DiffusionController { 4 4 5 + public function shouldAllowPublic() { 6 + return true; 7 + } 8 + 5 9 public function willProcessRequest(array $data) { 6 10 $data = $data + array( 7 11 'dblob' => $this->getRequest()->getStr('ref'),
+2 -1
src/applications/diffusion/request/DiffusionRequest.php
··· 371 371 * and formatting to the URI. Parameters are: 372 372 * 373 373 * - `action` One of `history`, `browse`, `change`, `lastmodified`, 374 - * `branch` or `revision-ref`. The action specified by the URI. 374 + * `branch`, `tags`, `branches`, or `revision-ref`. The action specified 375 + * by the URI. 375 376 * - `callsign` Repository callsign. 376 377 * - `branch` Optional if action is not `branch`, branch name. 377 378 * - `path` Optional, path to file.