1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-02 02:40:58 +01:00

Use status list UI to show reviewers in Differential

Summary:
Ref T1279. No logical changes, just updates the reviewer display style.

We currently keep track of only "requested changes".

Test Plan: See screenshot.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T1279

Differential Revision: https://secure.phabricator.com/D7228
This commit is contained in:
epriestley 2013-10-04 18:31:41 -07:00
parent 65ddefad8b
commit 4d8707df13
3 changed files with 45 additions and 17 deletions

View file

@ -19,7 +19,47 @@ final class DifferentialReviewersFieldSpecification
} }
public function renderValueForRevisionView() { public function renderValueForRevisionView() {
return $this->renderUserList($this->getReviewerPHIDs()); if (!$this->getReviewerPHIDs()) {
// Renders "None".
return $this->renderUserList(array());
}
$revision = $this->getRevision();
$reviewers = $revision->getReviewerStatus();
$diff = $revision->loadActiveDiff();
if ($diff) {
$diff = $diff->getID();
}
$view = new PHUIStatusListView();
$handles = $this->getLoadedHandles();
foreach ($reviewers as $reviewer) {
$phid = $reviewer->getReviewerPHID();
$item = new PHUIStatusItemView();
switch ($reviewer->getStatus()) {
case DifferentialReviewerStatus::STATUS_ADDED:
$item->setIcon('open-dark', pht('Review Requested'));
break;
case DifferentialReviewerStatus::STATUS_REJECTED:
if ($reviewer->getDiffID() == $diff) {
$item->setIcon(
'reject-red',
pht('Requested Changes'));
} else {
$item->setIcon(
'reject-dark',
pht('Requested Changes to Prior Diff'));
}
break;
}
$item->setTarget($handles[$phid]->renderLink());
$view->addItem($item);
}
return $view;
} }
private function getReviewerPHIDs() { private function getReviewerPHIDs() {

View file

@ -8,7 +8,8 @@ final class DifferentialReviewer {
public function __construct($reviewer_phid, $status, $diff_id = null) { public function __construct($reviewer_phid, $status, $diff_id = null) {
$this->reviewerPHID = $reviewer_phid; $this->reviewerPHID = $reviewer_phid;
$this->setStatus($status, $diff_id); $this->status = $status;
$this->diffID = $diff_id;
} }
public function getReviewerPHID() { public function getReviewerPHID() {
@ -23,17 +24,4 @@ final class DifferentialReviewer {
return $this->diffID; return $this->diffID;
} }
public function setStatus($status, $diff_id = null) {
if ($status == DifferentialReviewerStatus::STATUS_REJECTED
&& $diff_id === null) {
throw new Exception('STATUS_REJECTED must have a diff_id set');
}
$this->status = $status;
$this->diffID = $diff_id;
return $this;
}
} }

View file

@ -1004,10 +1004,10 @@ final class DiffusionCommitController extends DiffusionController {
$item->setIcon('warning-dark', pht('Audit Requested')); $item->setIcon('warning-dark', pht('Audit Requested'));
break; break;
case PhabricatorAuditStatusConstants::RESIGNED: case PhabricatorAuditStatusConstants::RESIGNED:
$item->setIcon('open-dark', pht('Accepted')); $item->setIcon('open-dark', pht('Resigned'));
break; break;
case PhabricatorAuditStatusConstants::CLOSED: case PhabricatorAuditStatusConstants::CLOSED:
$item->setIcon('accept-blue', pht('Accepted')); $item->setIcon('accept-blue', pht('Closed'));
break; break;
case PhabricatorAuditStatusConstants::CC: case PhabricatorAuditStatusConstants::CC:
$item->setIcon('info-dark', pht('Subscribed')); $item->setIcon('info-dark', pht('Subscribed'));