mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
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
This commit is contained in:
parent
48059265f3
commit
3910d0d5e1
6 changed files with 25 additions and 93 deletions
|
@ -94,35 +94,10 @@ final class DifferentialDiffViewController extends DifferentialController {
|
|||
$diff->getID());
|
||||
$props = mpull($props, 'getData', 'getName');
|
||||
|
||||
$aux_fields = DifferentialFieldSelector::newSelector()
|
||||
->getFieldSpecifications();
|
||||
foreach ($aux_fields as $key => $aux_field) {
|
||||
if (!$aux_field->shouldAppearOnDiffView()) {
|
||||
unset($aux_fields[$key]);
|
||||
} else {
|
||||
$aux_field->setUser($this->getRequest()->getUser());
|
||||
}
|
||||
}
|
||||
|
||||
$dict = array();
|
||||
foreach ($aux_fields as $key => $aux_field) {
|
||||
$aux_field->setDiff($diff);
|
||||
$aux_field->setManualDiff($diff);
|
||||
$aux_field->setDiffProperties($props);
|
||||
$value = $aux_field->renderValueForDiffView();
|
||||
if (strlen($value)) {
|
||||
$label = rtrim($aux_field->renderLabelForDiffView(), ':');
|
||||
$dict[$label] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$property_head = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Properties'));
|
||||
|
||||
$property_view = new PHUIPropertyListView();
|
||||
foreach ($dict as $key => $value) {
|
||||
$property_view->addProperty($key, $value);
|
||||
}
|
||||
|
||||
$changesets = $diff->loadChangesets();
|
||||
$changesets = msort($changesets, 'getSortKey');
|
||||
|
|
|
@ -30,8 +30,7 @@ final class DifferentialRevisionListController extends DifferentialController
|
|||
|
||||
$user = $this->getRequest()->getUser();
|
||||
$template = id(new DifferentialRevisionListView())
|
||||
->setUser($user)
|
||||
->setFields(DifferentialRevisionListView::getDefaultFields($user));
|
||||
->setUser($user);
|
||||
|
||||
$views = array();
|
||||
if ($query->getQueryKey() == 'active') {
|
||||
|
|
|
@ -766,7 +766,6 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
$view = id(new DifferentialRevisionListView())
|
||||
->setRevisions($revisions)
|
||||
->setFields(DifferentialRevisionListView::getDefaultFields($user))
|
||||
->setUser($user);
|
||||
|
||||
$phids = $view->getRequiredHandlePHIDs();
|
||||
|
|
|
@ -7,7 +7,6 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
|
||||
private $revisions;
|
||||
private $handles;
|
||||
private $fields;
|
||||
private $highlightAge;
|
||||
private $header;
|
||||
private $noDataString;
|
||||
|
@ -22,12 +21,6 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setFields(array $fields) {
|
||||
assert_instances_of($fields, 'DifferentialFieldSpecification');
|
||||
$this->fields = $fields;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setRevisions(array $revisions) {
|
||||
assert_instances_of($revisions, 'DifferentialRevision');
|
||||
$this->revisions = $revisions;
|
||||
|
@ -41,10 +34,12 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
|
||||
public function getRequiredHandlePHIDs() {
|
||||
$phids = array();
|
||||
foreach ($this->fields as $field) {
|
||||
foreach ($this->revisions as $revision) {
|
||||
$phids[] = $field->getRequiredHandlePHIDsForRevisionList($revision);
|
||||
}
|
||||
$phids[] = array($revision->getAuthorPHID());
|
||||
|
||||
// TODO: Switch to getReviewerStatus(), but not all callers pass us
|
||||
// revisions with this data loaded.
|
||||
$phids[] = $revision->getReviewers();
|
||||
}
|
||||
return array_mergev($phids);
|
||||
}
|
||||
|
@ -79,10 +74,6 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
$this->initBehavior('phabricator-tooltips', array());
|
||||
$this->requireResource('aphront-tooltip-css');
|
||||
|
||||
foreach ($this->fields as $field) {
|
||||
$field->setHandles($this->handles);
|
||||
}
|
||||
|
||||
$list = new PHUIObjectItemListView();
|
||||
$list->setCards(true);
|
||||
|
||||
|
@ -90,7 +81,6 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
$item = id(new PHUIObjectItemView())
|
||||
->setUser($user);
|
||||
|
||||
$rev_fields = array();
|
||||
$icons = array();
|
||||
|
||||
$phid = $revision->getPHID();
|
||||
|
@ -116,21 +106,12 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
$this->highlightAge &&
|
||||
!$revision->isClosed();
|
||||
|
||||
$object_age = PHUIObjectItemView::AGE_FRESH;
|
||||
foreach ($this->fields as $field) {
|
||||
if ($show_age) {
|
||||
if ($field instanceof DifferentialDateModifiedFieldSpecification) {
|
||||
if ($stale && $modified < $stale) {
|
||||
$object_age = PHUIObjectItemView::AGE_OLD;
|
||||
} else if ($fresh && $modified < $fresh) {
|
||||
$object_age = PHUIObjectItemView::AGE_STALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rev_header = $field->renderHeaderForRevisionList();
|
||||
$rev_fields[$rev_header] = $field
|
||||
->renderValueForRevisionList($revision);
|
||||
} else {
|
||||
$object_age = PHUIObjectItemView::AGE_FRESH;
|
||||
}
|
||||
|
||||
$status_name =
|
||||
|
@ -163,20 +144,19 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
$author_handle = $this->handles[$revision->getAuthorPHID()];
|
||||
$item->addByline(pht('Author: %s', $author_handle->renderLink()));
|
||||
|
||||
// Reviewers
|
||||
$item->addAttribute(pht('Reviewers: %s', $rev_fields['Reviewers']));
|
||||
|
||||
$item->setEpoch($revision->getDateModified(), $object_age);
|
||||
|
||||
// First remove the fields we already have
|
||||
$count = 7;
|
||||
$rev_fields = array_slice($rev_fields, $count);
|
||||
|
||||
// Then add each one of them
|
||||
// TODO: Add render-to-foot-icon support
|
||||
foreach ($rev_fields as $header => $field) {
|
||||
$item->addAttribute(pht('%s: %s', $header, $field));
|
||||
$reviewers = array();
|
||||
// TODO: As above, this should be based on `getReviewerStatus()`.
|
||||
foreach ($revision->getReviewers() as $reviewer) {
|
||||
$reviewers[] = $this->handles[$reviewer]->renderLink();
|
||||
}
|
||||
if (!$reviewers) {
|
||||
$reviewers = phutil_tag('em', array(), pht('None'));
|
||||
} else {
|
||||
$reviewers = phutil_implode_html(', ', $reviewers);
|
||||
}
|
||||
|
||||
$item->addAttribute(pht('Reviewers: %s', $reviewers));
|
||||
$item->setEpoch($revision->getDateModified(), $object_age);
|
||||
|
||||
switch ($status) {
|
||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||
|
@ -205,23 +185,4 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
return $list;
|
||||
}
|
||||
|
||||
public static function getDefaultFields(PhabricatorUser $user) {
|
||||
$selector = DifferentialFieldSelector::newSelector();
|
||||
$fields = $selector->getFieldSpecifications();
|
||||
foreach ($fields as $key => $field) {
|
||||
$field->setUser($user);
|
||||
if (!$field->shouldAppearOnRevisionList()) {
|
||||
unset($fields[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$fields) {
|
||||
throw new Exception(
|
||||
"Phabricator configuration has no fields that appear on the list ".
|
||||
"interface!");
|
||||
}
|
||||
|
||||
return $selector->sortFieldsForRevisionList($fields);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -211,7 +211,6 @@ abstract class DiffusionBrowseController extends DiffusionController {
|
|||
|
||||
$view = id(new DifferentialRevisionListView())
|
||||
->setRevisions($revisions)
|
||||
->setFields(DifferentialRevisionListView::getDefaultFields($user))
|
||||
->setUser($user);
|
||||
|
||||
$phids = $view->getRequiredHandlePHIDs();
|
||||
|
|
|
@ -219,7 +219,6 @@ final class PhabricatorHomeMainController
|
|||
$revision_view = id(new DifferentialRevisionListView())
|
||||
->setHighlightAge(true)
|
||||
->setRevisions(array_merge($blocking, $active))
|
||||
->setFields(DifferentialRevisionListView::getDefaultFields($user))
|
||||
->setUser($user);
|
||||
$phids = array_merge(
|
||||
array($user_phid),
|
||||
|
|
Loading…
Reference in a new issue