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

Remove field selector on Diff view and Revision List View

Summary:
Ref T2222. This has some minor functionality regressions:

- The plain diff page no longer shows unit/test status. I want to give diffs separate custom fields for this.
- It was technically possible to shove more data on the list view, although this doensn't affect the default config.

Test Plan: Looked at list view, diff detail view. Grepped for changes.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2222

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

+24 -92
-25
src/applications/differential/controller/DifferentialDiffViewController.php
··· 94 94 $diff->getID()); 95 95 $props = mpull($props, 'getData', 'getName'); 96 96 97 - $aux_fields = DifferentialFieldSelector::newSelector() 98 - ->getFieldSpecifications(); 99 - foreach ($aux_fields as $key => $aux_field) { 100 - if (!$aux_field->shouldAppearOnDiffView()) { 101 - unset($aux_fields[$key]); 102 - } else { 103 - $aux_field->setUser($this->getRequest()->getUser()); 104 - } 105 - } 106 - 107 - $dict = array(); 108 - foreach ($aux_fields as $key => $aux_field) { 109 - $aux_field->setDiff($diff); 110 - $aux_field->setManualDiff($diff); 111 - $aux_field->setDiffProperties($props); 112 - $value = $aux_field->renderValueForDiffView(); 113 - if (strlen($value)) { 114 - $label = rtrim($aux_field->renderLabelForDiffView(), ':'); 115 - $dict[$label] = $value; 116 - } 117 - } 118 - 119 97 $property_head = id(new PHUIHeaderView()) 120 98 ->setHeader(pht('Properties')); 121 99 122 100 $property_view = new PHUIPropertyListView(); 123 - foreach ($dict as $key => $value) { 124 - $property_view->addProperty($key, $value); 125 - } 126 101 127 102 $changesets = $diff->loadChangesets(); 128 103 $changesets = msort($changesets, 'getSortKey');
+1 -2
src/applications/differential/controller/DifferentialRevisionListController.php
··· 30 30 31 31 $user = $this->getRequest()->getUser(); 32 32 $template = id(new DifferentialRevisionListView()) 33 - ->setUser($user) 34 - ->setFields(DifferentialRevisionListView::getDefaultFields($user)); 33 + ->setUser($user); 35 34 36 35 $views = array(); 37 36 if ($query->getQueryKey() == 'active') {
-1
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 766 766 767 767 $view = id(new DifferentialRevisionListView()) 768 768 ->setRevisions($revisions) 769 - ->setFields(DifferentialRevisionListView::getDefaultFields($user)) 770 769 ->setUser($user); 771 770 772 771 $phids = $view->getRequiredHandlePHIDs();
+23 -62
src/applications/differential/view/DifferentialRevisionListView.php
··· 7 7 8 8 private $revisions; 9 9 private $handles; 10 - private $fields; 11 10 private $highlightAge; 12 11 private $header; 13 12 private $noDataString; ··· 22 21 return $this; 23 22 } 24 23 25 - public function setFields(array $fields) { 26 - assert_instances_of($fields, 'DifferentialFieldSpecification'); 27 - $this->fields = $fields; 28 - return $this; 29 - } 30 - 31 24 public function setRevisions(array $revisions) { 32 25 assert_instances_of($revisions, 'DifferentialRevision'); 33 26 $this->revisions = $revisions; ··· 41 34 42 35 public function getRequiredHandlePHIDs() { 43 36 $phids = array(); 44 - foreach ($this->fields as $field) { 45 - foreach ($this->revisions as $revision) { 46 - $phids[] = $field->getRequiredHandlePHIDsForRevisionList($revision); 47 - } 37 + foreach ($this->revisions as $revision) { 38 + $phids[] = array($revision->getAuthorPHID()); 39 + 40 + // TODO: Switch to getReviewerStatus(), but not all callers pass us 41 + // revisions with this data loaded. 42 + $phids[] = $revision->getReviewers(); 48 43 } 49 44 return array_mergev($phids); 50 45 } ··· 79 74 $this->initBehavior('phabricator-tooltips', array()); 80 75 $this->requireResource('aphront-tooltip-css'); 81 76 82 - foreach ($this->fields as $field) { 83 - $field->setHandles($this->handles); 84 - } 85 - 86 77 $list = new PHUIObjectItemListView(); 87 78 $list->setCards(true); 88 79 ··· 90 81 $item = id(new PHUIObjectItemView()) 91 82 ->setUser($user); 92 83 93 - $rev_fields = array(); 94 84 $icons = array(); 95 85 96 86 $phid = $revision->getPHID(); ··· 116 106 $this->highlightAge && 117 107 !$revision->isClosed(); 118 108 119 - $object_age = PHUIObjectItemView::AGE_FRESH; 120 - foreach ($this->fields as $field) { 121 - if ($show_age) { 122 - if ($field instanceof DifferentialDateModifiedFieldSpecification) { 123 - if ($stale && $modified < $stale) { 124 - $object_age = PHUIObjectItemView::AGE_OLD; 125 - } else if ($fresh && $modified < $fresh) { 126 - $object_age = PHUIObjectItemView::AGE_STALE; 127 - } 128 - } 129 - } 130 - 131 - $rev_header = $field->renderHeaderForRevisionList(); 132 - $rev_fields[$rev_header] = $field 133 - ->renderValueForRevisionList($revision); 109 + if ($stale && $modified < $stale) { 110 + $object_age = PHUIObjectItemView::AGE_OLD; 111 + } else if ($fresh && $modified < $fresh) { 112 + $object_age = PHUIObjectItemView::AGE_STALE; 113 + } else { 114 + $object_age = PHUIObjectItemView::AGE_FRESH; 134 115 } 135 116 136 117 $status_name = ··· 163 144 $author_handle = $this->handles[$revision->getAuthorPHID()]; 164 145 $item->addByline(pht('Author: %s', $author_handle->renderLink())); 165 146 166 - // Reviewers 167 - $item->addAttribute(pht('Reviewers: %s', $rev_fields['Reviewers'])); 147 + $reviewers = array(); 148 + // TODO: As above, this should be based on `getReviewerStatus()`. 149 + foreach ($revision->getReviewers() as $reviewer) { 150 + $reviewers[] = $this->handles[$reviewer]->renderLink(); 151 + } 152 + if (!$reviewers) { 153 + $reviewers = phutil_tag('em', array(), pht('None')); 154 + } else { 155 + $reviewers = phutil_implode_html(', ', $reviewers); 156 + } 168 157 158 + $item->addAttribute(pht('Reviewers: %s', $reviewers)); 169 159 $item->setEpoch($revision->getDateModified(), $object_age); 170 160 171 - // First remove the fields we already have 172 - $count = 7; 173 - $rev_fields = array_slice($rev_fields, $count); 174 - 175 - // Then add each one of them 176 - // TODO: Add render-to-foot-icon support 177 - foreach ($rev_fields as $header => $field) { 178 - $item->addAttribute(pht('%s: %s', $header, $field)); 179 - } 180 - 181 161 switch ($status) { 182 162 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: 183 163 break; ··· 203 183 $list->setNoDataString($this->noDataString); 204 184 205 185 return $list; 206 - } 207 - 208 - public static function getDefaultFields(PhabricatorUser $user) { 209 - $selector = DifferentialFieldSelector::newSelector(); 210 - $fields = $selector->getFieldSpecifications(); 211 - foreach ($fields as $key => $field) { 212 - $field->setUser($user); 213 - if (!$field->shouldAppearOnRevisionList()) { 214 - unset($fields[$key]); 215 - } 216 - } 217 - 218 - if (!$fields) { 219 - throw new Exception( 220 - "Phabricator configuration has no fields that appear on the list ". 221 - "interface!"); 222 - } 223 - 224 - return $selector->sortFieldsForRevisionList($fields); 225 186 } 226 187 227 188 }
-1
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 211 211 212 212 $view = id(new DifferentialRevisionListView()) 213 213 ->setRevisions($revisions) 214 - ->setFields(DifferentialRevisionListView::getDefaultFields($user)) 215 214 ->setUser($user); 216 215 217 216 $phids = $view->getRequiredHandlePHIDs();
-1
src/applications/home/controller/PhabricatorHomeMainController.php
··· 219 219 $revision_view = id(new DifferentialRevisionListView()) 220 220 ->setHighlightAge(true) 221 221 ->setRevisions(array_merge($blocking, $active)) 222 - ->setFields(DifferentialRevisionListView::getDefaultFields($user)) 223 222 ->setUser($user); 224 223 $phids = array_merge( 225 224 array($user_phid),