1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Move getPrimaryReviewer() to DifferentialRevision

Test Plan: Display revision list both with last reviewer and without.

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2495
This commit is contained in:
vrana 2012-05-18 00:33:21 -07:00
parent 9f35a3ba45
commit db1f94b0c0
2 changed files with 9 additions and 10 deletions

View file

@ -140,7 +140,7 @@ final class DifferentialReviewersFieldSpecification
} }
public function renderValueForRevisionList(DifferentialRevision $revision) { public function renderValueForRevisionList(DifferentialRevision $revision) {
$primary_reviewer = $this->getPrimaryReviewer($revision); $primary_reviewer = $revision->getPrimaryReviewer();
if ($primary_reviewer) { if ($primary_reviewer) {
$other_reviewers = array_flip($revision->getReviewers()); $other_reviewers = array_flip($revision->getReviewers());
unset($other_reviewers[$primary_reviewer]); unset($other_reviewers[$primary_reviewer]);
@ -157,19 +157,11 @@ final class DifferentialReviewersFieldSpecification
public function getRequiredHandlePHIDsForRevisionList( public function getRequiredHandlePHIDsForRevisionList(
DifferentialRevision $revision) { DifferentialRevision $revision) {
$primary_reviewer = $this->getPrimaryReviewer($revision); $primary_reviewer = $revision->getPrimaryReviewer();
if ($primary_reviewer) { if ($primary_reviewer) {
return array($primary_reviewer); return array($primary_reviewer);
} }
return array(); return array();
} }
private function getPrimaryReviewer(DifferentialRevision $revision) {
$primary_reviewer = $revision->getLastReviewerPHID();
if (!$primary_reviewer) {
$primary_reviewer = head($revision->getReviewers());
}
return $primary_reviewer;
}
} }

View file

@ -206,6 +206,13 @@ final class DifferentialRevision extends DifferentialDAO {
return array_keys($this->getUnsubscribed()); return array_keys($this->getUnsubscribed());
} }
public function getPrimaryReviewer() {
if (!$this->lastReviewerPHID) {
return head($this->getReviewers());
}
return $this->lastReviewerPHID;
}
public function loadReviewedBy() { public function loadReviewedBy() {
$reviewer = null; $reviewer = null;