Differential D17567 Diff 42271 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | switch ($xaction->getTransactionType()) { | ||||
case DifferentialAction::ACTION_ABANDON: | case DifferentialAction::ACTION_ABANDON: | ||||
return ($object->getStatus() != $status_abandoned); | return ($object->getStatus() != $status_abandoned); | ||||
case DifferentialAction::ACTION_RECLAIM: | case DifferentialAction::ACTION_RECLAIM: | ||||
return ($object->getStatus() == $status_abandoned); | return ($object->getStatus() == $status_abandoned); | ||||
case DifferentialAction::ACTION_REOPEN: | case DifferentialAction::ACTION_REOPEN: | ||||
return ($object->getStatus() == $status_closed); | return ($object->getStatus() == $status_closed); | ||||
case DifferentialAction::ACTION_RETHINK: | case DifferentialAction::ACTION_RETHINK: | ||||
return ($object->getStatus() != $status_plan); | return ($object->getStatus() != $status_plan); | ||||
case DifferentialAction::ACTION_REQUEST: | |||||
return ($object->getStatus() != $status_review); | |||||
case DifferentialAction::ACTION_CLAIM: | case DifferentialAction::ACTION_CLAIM: | ||||
return ($actor_phid != $object->getAuthorPHID()); | return ($actor_phid != $object->getAuthorPHID()); | ||||
} | } | ||||
} | } | ||||
return parent::transactionHasEffect($object, $xaction); | return parent::transactionHasEffect($object, $xaction); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | switch ($xaction->getTransactionType()) { | ||||
$object->setStatus($status_plan); | $object->setStatus($status_plan); | ||||
return; | return; | ||||
case DifferentialAction::ACTION_RECLAIM: | case DifferentialAction::ACTION_RECLAIM: | ||||
$object->setStatus($status_review); | $object->setStatus($status_review); | ||||
return; | return; | ||||
case DifferentialAction::ACTION_REOPEN: | case DifferentialAction::ACTION_REOPEN: | ||||
$object->setStatus($status_review); | $object->setStatus($status_review); | ||||
return; | return; | ||||
case DifferentialAction::ACTION_REQUEST: | |||||
$object->setStatus($status_review); | |||||
return; | |||||
case DifferentialAction::ACTION_CLOSE: | case DifferentialAction::ACTION_CLOSE: | ||||
$old_status = $object->getStatus(); | $old_status = $object->getStatus(); | ||||
$object->setStatus(ArcanistDifferentialRevisionStatus::CLOSED); | $object->setStatus(ArcanistDifferentialRevisionStatus::CLOSED); | ||||
$was_accepted = ($old_status == $status_accepted); | $was_accepted = ($old_status == $status_accepted); | ||||
$object->setProperty( | $object->setProperty( | ||||
DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED, | DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED, | ||||
$was_accepted); | $was_accepted); | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | if ($this->getIsCloseByCommit()) { | ||||
// If the old state isn't "changes planned", downgrade the accepts. | // If the old state isn't "changes planned", downgrade the accepts. | ||||
// This exception allows an accepted revision to go through | // This exception allows an accepted revision to go through | ||||
// "Plan Changes" -> "Request Review" and return to "accepted" if | // "Plan Changes" -> "Request Review" and return to "accepted" if | ||||
// the author didn't update the revision, essentially undoing the | // the author didn't update the revision, essentially undoing the | ||||
// "Plan Changes". | // "Plan Changes". | ||||
$downgrade_accepts = true; | $downgrade_accepts = true; | ||||
} | } | ||||
break; | break; | ||||
// TODO: Remove this, obsoleted by ModularTransactions above. | |||||
case DifferentialTransaction::TYPE_ACTION: | |||||
switch ($xaction->getNewValue()) { | |||||
case DifferentialAction::ACTION_REQUEST: | |||||
$downgrade_rejects = true; | |||||
if ((!$is_sticky_accept) || | |||||
($object->getStatus() != $status_plan)) { | |||||
$downgrade_accepts = true; | |||||
} | |||||
break; | |||||
} | |||||
break; | |||||
} | } | ||||
} | } | ||||
$new_accept = DifferentialReviewerStatus::STATUS_ACCEPTED; | $new_accept = DifferentialReviewerStatus::STATUS_ACCEPTED; | ||||
$new_reject = DifferentialReviewerStatus::STATUS_REJECTED; | $new_reject = DifferentialReviewerStatus::STATUS_REJECTED; | ||||
$old_accept = DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER; | $old_accept = DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER; | ||||
$old_reject = DifferentialReviewerStatus::STATUS_REJECTED_OLDER; | $old_reject = DifferentialReviewerStatus::STATUS_REJECTED_OLDER; | ||||
▲ Show 20 Lines • Show All 629 Lines • ▼ Show 20 Lines | switch ($action) { | ||||
pht( | pht( | ||||
'Encountered unexpected revision status ("%s") when '. | 'Encountered unexpected revision status ("%s") when '. | ||||
'validating "%s" action.', | 'validating "%s" action.', | ||||
$revision_status, | $revision_status, | ||||
$action)); | $action)); | ||||
} | } | ||||
break; | break; | ||||
case DifferentialAction::ACTION_REQUEST: | |||||
if (!$actor_is_author) { | |||||
return pht( | |||||
'You can not request review of this revision because you do '. | |||||
'not own it. To request review of a revision, you must be its '. | |||||
'owner.'); | |||||
} | |||||
switch ($revision_status) { | |||||
case ArcanistDifferentialRevisionStatus::ACCEPTED: | |||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: | |||||
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED: | |||||
// These are OK. | |||||
break; | |||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: | |||||
// This will be caught as "no effect" later on. | |||||
break; | |||||
case ArcanistDifferentialRevisionStatus::ABANDONED: | |||||
return pht( | |||||
'You can not request review of this revision because it has '. | |||||
'been abandoned. Instead, reclaim it.'); | |||||
case ArcanistDifferentialRevisionStatus::CLOSED: | |||||
return pht( | |||||
'You can not request review of this revision because it has '. | |||||
'already been closed.'); | |||||
default: | |||||
throw new Exception( | |||||
pht( | |||||
'Encountered unexpected revision status ("%s") when '. | |||||
'validating "%s" action.', | |||||
$revision_status, | |||||
$action)); | |||||
} | |||||
break; | |||||
case DifferentialAction::ACTION_CLOSE: | case DifferentialAction::ACTION_CLOSE: | ||||
// We force revisions closed when we discover a corresponding commit. | // We force revisions closed when we discover a corresponding commit. | ||||
// In this case, revisions are allowed to transition to closed from | // In this case, revisions are allowed to transition to closed from | ||||
// any state. This is an automated action taken by the daemons. | // any state. This is an automated action taken by the daemons. | ||||
if (!$this->getIsCloseByCommit()) { | if (!$this->getIsCloseByCommit()) { | ||||
if (!$actor_is_author && !$always_allow_close) { | if (!$actor_is_author && !$always_allow_close) { | ||||
return pht( | return pht( | ||||
▲ Show 20 Lines • Show All 921 Lines • Show Last 20 Lines |