1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30: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) {
$primary_reviewer = $this->getPrimaryReviewer($revision);
$primary_reviewer = $revision->getPrimaryReviewer();
if ($primary_reviewer) {
$other_reviewers = array_flip($revision->getReviewers());
unset($other_reviewers[$primary_reviewer]);
@ -157,19 +157,11 @@ final class DifferentialReviewersFieldSpecification
public function getRequiredHandlePHIDsForRevisionList(
DifferentialRevision $revision) {
$primary_reviewer = $this->getPrimaryReviewer($revision);
$primary_reviewer = $revision->getPrimaryReviewer();
if ($primary_reviewer) {
return array($primary_reviewer);
}
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());
}
public function getPrimaryReviewer() {
if (!$this->lastReviewerPHID) {
return head($this->getReviewers());
}
return $this->lastReviewerPHID;
}
public function loadReviewedBy() {
$reviewer = null;