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

Restore "Forks" to Paste

Summary:
I just put them in the property table instead of a list at the foot, they looked weird down there and were too bulky relative to their importance.

This won't scale great if someone forks a paste ten thousand times or whatever, but we can deal with that when we get there.

Also clean up a few things and tweak some styles,

Test Plan: Looked at forked, unforked pastes.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+68 -40
+2 -2
src/__celerity_resource_map__.php
··· 2537 2537 ), 2538 2538 'phabricator-property-list-view-css' => 2539 2539 array( 2540 - 'uri' => '/res/4a2b2d85/rsrc/css/layout/phabricator-property-list-view.css', 2540 + 'uri' => '/res/598fccad/rsrc/css/layout/phabricator-property-list-view.css', 2541 2541 'type' => 'css', 2542 2542 'requires' => 2543 2543 array( ··· 2585 2585 ), 2586 2586 'phabricator-source-code-view-css' => 2587 2587 array( 2588 - 'uri' => '/res/631aa90a/rsrc/css/layout/phabricator-source-code-view.css', 2588 + 'uri' => '/res/cf0c566c/rsrc/css/layout/phabricator-source-code-view.css', 2589 2589 'type' => 'css', 2590 2590 'requires' => 2591 2591 array(
-2
src/__phutil_library_map__.php
··· 892 892 'PhabricatorPaste' => 'applications/paste/storage/PhabricatorPaste.php', 893 893 'PhabricatorPasteController' => 'applications/paste/controller/PhabricatorPasteController.php', 894 894 'PhabricatorPasteDAO' => 'applications/paste/storage/PhabricatorPasteDAO.php', 895 - 'PhabricatorPasteEditController' => 'applications/paste/controller/PhabricatorPasteEditController.php', 896 895 'PhabricatorPasteListController' => 'applications/paste/controller/PhabricatorPasteListController.php', 897 896 'PhabricatorPasteQuery' => 'applications/paste/query/PhabricatorPasteQuery.php', 898 897 'PhabricatorPasteViewController' => 'applications/paste/controller/PhabricatorPasteViewController.php', ··· 1992 1991 ), 1993 1992 'PhabricatorPasteController' => 'PhabricatorController', 1994 1993 'PhabricatorPasteDAO' => 'PhabricatorLiskDAO', 1995 - 'PhabricatorPasteEditController' => 'PhabricatorPasteController', 1996 1994 'PhabricatorPasteListController' => 'PhabricatorPasteController', 1997 1995 'PhabricatorPasteQuery' => 'PhabricatorCursorPagedPolicyQuery', 1998 1996 'PhabricatorPasteViewController' => 'PhabricatorPasteController',
+9
src/applications/base/controller/PhabricatorController.php
··· 222 222 ->loadHandles(); 223 223 return $this; 224 224 } 225 + 226 + protected function renderHandleList(array $phids) { 227 + $items = array(); 228 + foreach ($phids as $phid) { 229 + $items[] = $this->getHandle($phid)->renderLink(); 230 + } 231 + return implode('<br />', $items); 232 + } 233 + 225 234 }
-14
src/applications/paste/controller/PhabricatorPasteController.php
··· 38 38 return $nav; 39 39 } 40 40 41 - public function buildStandardPageResponse($view, array $data) { 42 - 43 - $page = $this->buildStandardPageView(); 44 - 45 - $page->setApplicationName('Paste'); 46 - $page->setBaseURI('/paste/'); 47 - $page->setTitle(idx($data, 'title')); 48 - $page->setGlyph("\xE2\x9C\x8E"); 49 - $page->appendChild($view); 50 - 51 - $response = new AphrontWebpageResponse(); 52 - return $response->setContent($page->render()); 53 - 54 - } 55 41 }
+7 -8
src/applications/paste/controller/PhabricatorPasteListController.php
··· 105 105 $side_nav = $this->buildSideNavView(); 106 106 $side_nav->selectFilter($this->getFilter()); 107 107 108 - 109 108 if ($this->getErrorView()) { 110 109 $side_nav->appendChild($this->getErrorView()); 111 110 } ··· 132 131 133 132 $this->loadHandles(mpull($paste_list, 'getAuthorPHID')); 134 133 135 - $side_nav->appendChild( 136 - $this->renderPasteList($paste_list, $header, $pager)); 134 + $list = $this->buildPasteList($paste_list); 135 + $list->setHeader($header); 136 + $list->setPager($pager); 137 137 138 + $side_nav->appendChild($list); 138 139 139 140 return $this->buildApplicationPage( 140 141 $side_nav, ··· 288 289 return $create_panel; 289 290 } 290 291 291 - private function renderPasteList(array $pastes, $header, $pager) { 292 + private function buildPasteList(array $pastes) { 292 293 assert_instances_of($pastes, 'PhabricatorPaste'); 293 294 294 295 $user = $this->getRequest()->getUser(); 295 296 296 297 $list = new PhabricatorObjectItemListView(); 297 - $list->setHeader($header); 298 298 foreach ($pastes as $paste) { 299 299 $created = phabricator_datetime($paste->getDateCreated(), $user); 300 300 301 301 $item = id(new PhabricatorObjectItemView()) 302 - ->setHeader('P'.$paste->getID().' '.$paste->getTitle()) 302 + ->setHeader($paste->getFullName()) 303 303 ->setHref('/P'.$paste->getID()) 304 304 ->addDetail( 305 305 pht('Author'), ··· 309 309 $list->addItem($item); 310 310 } 311 311 312 - $list->setPager($pager); 313 - 314 312 return $list; 315 313 } 314 + 316 315 }
+25 -8
src/applications/paste/controller/PhabricatorPasteViewController.php
··· 44 44 return new Aphront400Response(); 45 45 } 46 46 47 + $forks = id(new PhabricatorPasteQuery()) 48 + ->setViewer($user) 49 + ->withParentPHIDs(array($paste->getPHID())) 50 + ->execute(); 51 + $fork_phids = mpull($forks, 'getPHID'); 52 + 47 53 $this->loadHandles( 48 - array( 49 - $paste->getAuthorPHID(), 50 - $paste->getParentPHID(), 51 - )); 54 + array_merge( 55 + array( 56 + $paste->getAuthorPHID(), 57 + $paste->getParentPHID(), 58 + ), 59 + $fork_phids)); 52 60 53 61 $header = $this->buildHeaderView($paste); 54 62 $actions = $this->buildActionView($paste, $file); 55 - $properties = $this->buildPropertyView($paste); 63 + $properties = $this->buildPropertyView($paste, $fork_phids); 56 64 $source_code = $this->buildSourceCodeView($paste, $file); 57 65 58 66 $nav = $this->buildSideNavView($paste); 59 67 $nav->selectFilter('paste'); 68 + 60 69 $nav->appendChild( 61 70 array( 62 71 $header, 63 72 $actions, 64 73 $properties, 65 74 $source_code, 66 - // $forks_panel, 67 75 )); 68 76 69 77 return $this->buildApplicationPage( 70 78 $nav, 71 79 array( 72 - 'title' => 'P'.$paste->getID().' '.$paste->getTitle(), 80 + 'title' => $paste->getFullName(), 73 81 'device' => true, 74 82 )); 75 83 } ··· 97 105 ->setHref($file->getBestURI())); 98 106 } 99 107 100 - private function buildPropertyView(PhabricatorPaste $paste) { 108 + private function buildPropertyView( 109 + PhabricatorPaste $paste, 110 + array $child_phids) { 111 + 101 112 $user = $this->getRequest()->getUser(); 102 113 $properties = new PhabricatorPropertyListView(); 103 114 ··· 113 124 $properties->addProperty( 114 125 pht('Forked From'), 115 126 $this->getHandle($paste->getParentPHID())->renderLink()); 127 + } 128 + 129 + if ($child_phids) { 130 + $properties->addProperty( 131 + pht('Forks'), 132 + $this->renderHandleList($child_phids)); 116 133 } 117 134 118 135 return $properties;
+13
src/applications/paste/query/PhabricatorPasteQuery.php
··· 21 21 private $ids; 22 22 private $phids; 23 23 private $authorPHIDs; 24 + private $parentPHIDs; 24 25 25 26 public function withIDs(array $ids) { 26 27 $this->ids = $ids; ··· 34 35 35 36 public function withAuthorPHIDs(array $phids) { 36 37 $this->authorPHIDs = $phids; 38 + return $this; 39 + } 40 + 41 + public function withParentPHIDs(array $phids) { 42 + $this->parentPHIDs = $phids; 37 43 return $this; 38 44 } 39 45 ··· 78 84 $conn_r, 79 85 'authorPHID IN (%Ls)', 80 86 $this->authorPHIDs); 87 + } 88 + 89 + if ($this->parentPHIDs) { 90 + $where[] = qsprintf( 91 + $conn_r, 92 + 'parentPHID IN (%Ls)', 93 + $this->parentPHIDs); 81 94 } 82 95 83 96 return $this->formatWhereClause($where);
+8
src/applications/paste/storage/PhabricatorPaste.php
··· 51 51 return ($user->getPHID() == $this->getAuthorPHID()); 52 52 } 53 53 54 + public function getFullName() { 55 + $title = $this->getTitle(); 56 + if (!$title) { 57 + $title = 'Untitled Masterwork'; 58 + } 59 + return 'P'.$this->getID().' '.$title; 60 + } 61 + 54 62 }
+2 -4
webroot/rsrc/css/layout/phabricator-property-list-view.css
··· 11 11 overflow: hidden; 12 12 } 13 13 14 - .device-desktop .phabricator-property-list-view, 15 - .device-tablet .phabricator-property-list-view { 14 + .device-desktop .phabricator-property-list-view { 16 15 padding: 1em 0 0.75em; 17 16 } 18 17 19 - 18 + .device-tablet .phabricator-property-list-view, 20 19 .device-phone .phabricator-property-list-view { 21 20 padding: .5em; 22 21 } ··· 50 49 float: left; 51 50 margin-bottom: .5em; 52 51 } 53 - 54 52 55 53 .device-tablet .phabricator-property-value, 56 54 .device-phone .phabricator-property-value {
+2 -2
webroot/rsrc/css/layout/phabricator-source-code-view.css
··· 4 4 5 5 .phabricator-source-code { 6 6 white-space: pre-wrap; 7 - padding: 3px 8px; 7 + padding: 2px 8px 1px; 8 8 } 9 9 10 10 .phabricator-source-line { 11 11 text-align: right; 12 - padding: 3px 6px 3px 12px; 12 + padding: 2px 6px 1px 12px; 13 13 14 14 border-right: 1px solid #dbdbdb; 15 15 font-weight: bold;