Allow revisions to be commandeered
Summary: - Adds "Commandeer Revision", to allow you to plunder revisions from those lost to sea (e.g., interns who have left or co-workers who are dealing with a family emergency). - Removes admin-abandon to simplify things, since you can just Commandeer + Abandon now. - There are other workarounds available but this is the natural/expected workflow (and the one everyone always asks for) and there's no real reason not to allow it. Test Plan: Swashbuckled. Reviewers: cpiro, btrahan, vrana, jungejason Reviewed By: cpiro CC: aran, zeeg Differential Revision: https://secure.phabricator.com/D2257
This commit is contained in:
@@ -477,17 +477,16 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
$actions = array(
|
||||
DifferentialAction::ACTION_COMMENT => true,
|
||||
);
|
||||
$admin_actions = array();
|
||||
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
$viewer_phid = $viewer->getPHID();
|
||||
$viewer_is_admin = $viewer->getIsAdmin();
|
||||
$viewer_is_owner = ($viewer_phid == $revision->getAuthorPHID());
|
||||
$viewer_is_reviewer = in_array($viewer_phid, $revision->getReviewers());
|
||||
$viewer_did_accept = ($viewer_phid === $revision->loadReviewedBy());
|
||||
$status = $revision->getStatus();
|
||||
|
||||
if ($viewer_is_owner) {
|
||||
switch ($revision->getStatus()) {
|
||||
switch ($status) {
|
||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||
$actions[DifferentialAction::ACTION_ABANDON] = true;
|
||||
$actions[DifferentialAction::ACTION_RETHINK] = true;
|
||||
@@ -509,20 +508,17 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($revision->getStatus()) {
|
||||
switch ($status) {
|
||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||
$admin_actions[DifferentialAction::ACTION_ABANDON] = $viewer_is_admin;
|
||||
$actions[DifferentialAction::ACTION_ACCEPT] = true;
|
||||
$actions[DifferentialAction::ACTION_REJECT] = true;
|
||||
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
|
||||
break;
|
||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
||||
$admin_actions[DifferentialAction::ACTION_ABANDON] = $viewer_is_admin;
|
||||
$actions[DifferentialAction::ACTION_ACCEPT] = true;
|
||||
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
|
||||
break;
|
||||
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
||||
$admin_actions[DifferentialAction::ACTION_ABANDON] = $viewer_is_admin;
|
||||
$actions[DifferentialAction::ACTION_REJECT] = true;
|
||||
$actions[DifferentialAction::ACTION_RESIGN] =
|
||||
$viewer_is_reviewer && !$viewer_did_accept;
|
||||
@@ -531,22 +527,19 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
case ArcanistDifferentialRevisionStatus::ABANDONED:
|
||||
break;
|
||||
}
|
||||
if ($status != ArcanistDifferentialRevisionStatus::COMMITTED) {
|
||||
$actions[DifferentialAction::ACTION_CLAIM] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$actions[DifferentialAction::ACTION_ADDREVIEWERS] = true;
|
||||
$actions[DifferentialAction::ACTION_ADDCCS] = true;
|
||||
|
||||
$actions = array_keys(array_filter($actions));
|
||||
$admin_actions = array_keys(array_filter($admin_actions));
|
||||
$actions_dict = array();
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$actions_dict[$action] = DifferentialAction::getActionVerb($action);
|
||||
}
|
||||
foreach ($admin_actions as $action) {
|
||||
$actions_dict[$action] =
|
||||
'(Admin) ' . DifferentialAction::getActionVerb($action);
|
||||
}
|
||||
|
||||
return $actions_dict;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user