1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 13:52:40 +01:00

Highlight reviews the viewer is responsible for in Differential

Summary: Ref T1279. No logical changes, but cosmetically highlight stuff you have authority for, like we do in Diffusion.

Test Plan: See screenshot.

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1279

Differential Revision: https://secure.phabricator.com/D7237
This commit is contained in:
epriestley 2013-10-05 11:50:00 -07:00
parent 4c0ec01ce5
commit c80a4f51c1
3 changed files with 28 additions and 1 deletions

View file

@ -27,9 +27,24 @@ final class DifferentialProjectReviewersFieldSpecification
return null;
}
$highlight = array();
if ($this->getUser()->getPHID() != $this->getRevision()->getAuthorPHID()) {
// Determine which of these projects the viewer is a member of, so we can
// highlight them. (If the viewer is the author, skip this since they
// can't review.)
$phids = mpull($reviewers, 'getReviewerPHID');
$projects = id(new PhabricatorProjectQuery())
->setViewer($this->getUser())
->withPHIDs($phids)
->withMemberPHIDs(array($this->getUser()->getPHID()))
->execute();
$highlight = mpull($projects, 'getPHID');
}
$view = id(new DifferentialReviewersView())
->setReviewers($reviewers)
->setHandles($this->getLoadedHandles());
->setHandles($this->getLoadedHandles())
->setHighlightPHIDs($highlight);
$diff = $this->getRevision()->loadActiveDiff();
if ($diff) {

View file

@ -33,6 +33,7 @@ final class DifferentialReviewersFieldSpecification
$view = id(new DifferentialReviewersView())
->setReviewers($reviewers)
->setHighlightPHIDs(array($this->getUser()->getPHID()))
->setHandles($this->getLoadedHandles());
$diff = $this->getRevision()->loadActiveDiff();

View file

@ -5,6 +5,7 @@ final class DifferentialReviewersView extends AphrontView {
private $reviewers;
private $handles;
private $diff;
private $highlightPHIDs = array();
public function setReviewers(array $reviewers) {
assert_instances_of($reviewers, 'DifferentialReviewer');
@ -23,9 +24,16 @@ final class DifferentialReviewersView extends AphrontView {
return $this;
}
public function setHighlightPHIDs(array $phids) {
$this->highlightPHIDs = $phids;
return $this;
}
public function render() {
$view = new PHUIStatusListView();
$highlighted = array_fuse($this->highlightPHIDs);
foreach ($this->reviewers as $reviewer) {
$phid = $reviewer->getReviewerPHID();
$handle = $this->handles[$phid];
@ -38,6 +46,9 @@ final class DifferentialReviewersView extends AphrontView {
$item = new PHUIStatusItemView();
if (isset($highlighted[$phid])) {
$item->setHighlighted(true);
}
switch ($reviewer->getStatus()) {
case DifferentialReviewerStatus::STATUS_ADDED: