Differential D17569 Diff 42273 src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | private function isViewerReviewerStatusFully( | ||||
$is_accepted = ($require_status == $status_accepted); | $is_accepted = ($require_status == $status_accepted); | ||||
$is_rejected = ($require_status == $status_rejected); | $is_rejected = ($require_status == $status_rejected); | ||||
// Otherwise, check that all reviews they have authority over are in | // Otherwise, check that all reviews they have authority over are in | ||||
// the desired set of states. | // the desired set of states. | ||||
foreach ($revision->getReviewers() as $reviewer) { | foreach ($revision->getReviewers() as $reviewer) { | ||||
if (!$reviewer->hasAuthority($viewer)) { | if (!$reviewer->hasAuthority($viewer)) { | ||||
$can_force = false; | |||||
if ($is_accepted) { | |||||
if ($revision->canReviewerForceAccept($viewer, $reviewer)) { | |||||
$can_force = true; | |||||
} | |||||
} | |||||
if (!$can_force) { | |||||
continue; | continue; | ||||
} | } | ||||
} | |||||
$status = $reviewer->getReviewerStatus(); | $status = $reviewer->getReviewerStatus(); | ||||
if ($status != $require_status) { | if ($status != $require_status) { | ||||
return false; | return false; | ||||
} | } | ||||
// Here, we're primarily testing if we can remove a void on the review. | // Here, we're primarily testing if we can remove a void on the review. | ||||
if ($is_accepted) { | if ($is_accepted) { | ||||
Show All 25 Lines | protected function applyReviewerEffect( | ||||
$status) { | $status) { | ||||
$map = array(); | $map = array(); | ||||
// When you accept or reject, you may accept or reject on behalf of all | // When you accept or reject, you may accept or reject on behalf of all | ||||
// reviewers you have authority for. When you resign, you only affect | // reviewers you have authority for. When you resign, you only affect | ||||
// yourself. | // yourself. | ||||
$with_authority = ($status != DifferentialReviewerStatus::STATUS_RESIGNED); | $with_authority = ($status != DifferentialReviewerStatus::STATUS_RESIGNED); | ||||
$with_force = ($status == DifferentialReviewerStatus::STATUS_ACCEPTED); | |||||
if ($with_authority) { | if ($with_authority) { | ||||
foreach ($revision->getReviewers() as $reviewer) { | foreach ($revision->getReviewers() as $reviewer) { | ||||
if ($reviewer->hasAuthority($viewer)) { | if (!$reviewer->hasAuthority($viewer)) { | ||||
$map[$reviewer->getReviewerPHID()] = $status; | if (!$with_force) { | ||||
continue; | |||||
} | |||||
if (!$revision->canReviewerForceAccept($viewer, $reviewer)) { | |||||
continue; | |||||
} | |||||
} | } | ||||
$map[$reviewer->getReviewerPHID()] = $status; | |||||
} | } | ||||
} | } | ||||
// In all cases, you affect yourself. | // In all cases, you affect yourself. | ||||
$map[$viewer->getPHID()] = $status; | $map[$viewer->getPHID()] = $status; | ||||
// If the user has submitted a specific list of reviewers to act as (by | // If the user has submitted a specific list of reviewers to act as (by | ||||
// unchecking some checkboxes under "Accept"), only affect those reviewers. | // unchecking some checkboxes under "Accept"), only affect those reviewers. | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |