mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 21:32:43 +01:00
Add an explcit "Changes Planned" state for Differential
Summary: Ref T2222. Ref T4481. This fixes the issue where "Plan Changes" could immediately trigger a state change (e.g., back to accepted) because of state-based transitions out of the NEEDS_REVISION state. Test Plan: Planned changes an "accepted" revision, it didn't immediately return to being accepted. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222, T4481 Differential Revision: https://secure.phabricator.com/D8403
This commit is contained in:
parent
9da6ec2081
commit
4ef87eeac8
5 changed files with 24 additions and 4 deletions
|
@ -21,12 +21,16 @@ final class DifferentialRevisionStatus {
|
||||||
self::COLOR_STATUS_DEFAULT,
|
self::COLOR_STATUS_DEFAULT,
|
||||||
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
||||||
self::COLOR_STATUS_RED,
|
self::COLOR_STATUS_RED,
|
||||||
|
ArcanistDifferentialRevisionStatus::CHANGES_PLANNED =>
|
||||||
|
self::COLOR_STATUS_RED,
|
||||||
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
||||||
self::COLOR_STATUS_GREEN,
|
self::COLOR_STATUS_GREEN,
|
||||||
ArcanistDifferentialRevisionStatus::CLOSED =>
|
ArcanistDifferentialRevisionStatus::CLOSED =>
|
||||||
self::COLOR_STATUS_DARK,
|
self::COLOR_STATUS_DARK,
|
||||||
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
||||||
self::COLOR_STATUS_DARK,
|
self::COLOR_STATUS_DARK,
|
||||||
|
ArcanistDifferentialRevisionStatus::IN_PREPARATION =>
|
||||||
|
self::COLOR_STATUS_DARK,
|
||||||
);
|
);
|
||||||
return idx($map, $status, $default);
|
return idx($map, $status, $default);
|
||||||
}
|
}
|
||||||
|
@ -39,12 +43,16 @@ final class DifferentialRevisionStatus {
|
||||||
'oh-open',
|
'oh-open',
|
||||||
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
||||||
'oh-open-red',
|
'oh-open-red',
|
||||||
|
ArcanistDifferentialRevisionStatus::CHANGES_PLANNED =>
|
||||||
|
'oh-open-red',
|
||||||
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
||||||
'oh-open-green',
|
'oh-open-green',
|
||||||
ArcanistDifferentialRevisionStatus::CLOSED =>
|
ArcanistDifferentialRevisionStatus::CLOSED =>
|
||||||
'oh-closed-dark',
|
'oh-closed-dark',
|
||||||
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
||||||
'oh-closed-dark',
|
'oh-closed-dark',
|
||||||
|
ArcanistDifferentialRevisionStatus::IN_PREPARATION =>
|
||||||
|
'question-blue',
|
||||||
);
|
);
|
||||||
return idx($map, $status, $default);
|
return idx($map, $status, $default);
|
||||||
}
|
}
|
||||||
|
@ -92,9 +100,11 @@ final class DifferentialRevisionStatus {
|
||||||
return array(
|
return array(
|
||||||
ArcanistDifferentialRevisionStatus::NEEDS_REVIEW,
|
ArcanistDifferentialRevisionStatus::NEEDS_REVIEW,
|
||||||
ArcanistDifferentialRevisionStatus::NEEDS_REVISION,
|
ArcanistDifferentialRevisionStatus::NEEDS_REVISION,
|
||||||
|
ArcanistDifferentialRevisionStatus::CHANGES_PLANNED,
|
||||||
ArcanistDifferentialRevisionStatus::ACCEPTED,
|
ArcanistDifferentialRevisionStatus::ACCEPTED,
|
||||||
ArcanistDifferentialRevisionStatus::CLOSED,
|
ArcanistDifferentialRevisionStatus::CLOSED,
|
||||||
ArcanistDifferentialRevisionStatus::ABANDONED,
|
ArcanistDifferentialRevisionStatus::ABANDONED,
|
||||||
|
ArcanistDifferentialRevisionStatus::IN_PREPARATION,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,6 +523,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||||
$actions[DifferentialAction::ACTION_RETHINK] = true;
|
$actions[DifferentialAction::ACTION_RETHINK] = true;
|
||||||
break;
|
break;
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
||||||
|
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
|
||||||
$actions[DifferentialAction::ACTION_ACCEPT] = $allow_self_accept;
|
$actions[DifferentialAction::ACTION_ACCEPT] = $allow_self_accept;
|
||||||
$actions[DifferentialAction::ACTION_ABANDON] = true;
|
$actions[DifferentialAction::ACTION_ABANDON] = true;
|
||||||
$actions[DifferentialAction::ACTION_REQUEST] = true;
|
$actions[DifferentialAction::ACTION_REQUEST] = true;
|
||||||
|
@ -547,6 +548,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||||
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
|
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
|
||||||
break;
|
break;
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
||||||
|
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
|
||||||
$actions[DifferentialAction::ACTION_ACCEPT] = true;
|
$actions[DifferentialAction::ACTION_ACCEPT] = true;
|
||||||
$actions[DifferentialAction::ACTION_REJECT] = !$viewer_has_rejected;
|
$actions[DifferentialAction::ACTION_REJECT] = !$viewer_has_rejected;
|
||||||
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
|
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
|
||||||
|
|
|
@ -437,6 +437,7 @@ final class DifferentialRevisionEditor extends PhabricatorEditor {
|
||||||
// be able to put the revision into "accepted".
|
// be able to put the revision into "accepted".
|
||||||
switch ($revision->getStatus()) {
|
switch ($revision->getStatus()) {
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
||||||
|
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||||
$revision = self::updateAcceptedStatus(
|
$revision = self::updateAcceptedStatus(
|
||||||
$this->getActor(),
|
$this->getActor(),
|
||||||
|
|
|
@ -72,6 +72,7 @@ final class DifferentialTransactionEditor
|
||||||
$status_abandoned = ArcanistDifferentialRevisionStatus::ABANDONED;
|
$status_abandoned = ArcanistDifferentialRevisionStatus::ABANDONED;
|
||||||
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
||||||
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
|
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
|
||||||
|
$status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
|
||||||
|
|
||||||
$action_type = $xaction->getNewValue();
|
$action_type = $xaction->getNewValue();
|
||||||
switch ($action_type) {
|
switch ($action_type) {
|
||||||
|
@ -86,7 +87,7 @@ final class DifferentialTransactionEditor
|
||||||
$actor = $this->getActor();
|
$actor = $this->getActor();
|
||||||
$actor_phid = $actor->getPHID();
|
$actor_phid = $actor->getPHID();
|
||||||
|
|
||||||
// These transactions can cause effects in to ways: by altering the
|
// These transactions can cause effects in two ways: by altering the
|
||||||
// status of an existing reviewer; or by adding the actor as a new
|
// status of an existing reviewer; or by adding the actor as a new
|
||||||
// reviewer.
|
// reviewer.
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ final class DifferentialTransactionEditor
|
||||||
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_revision);
|
return ($object->getStatus() != $status_plan);
|
||||||
case DifferentialAction::ACTION_REQUEST:
|
case DifferentialAction::ACTION_REQUEST:
|
||||||
return ($object->getStatus() != $status_review);
|
return ($object->getStatus() != $status_review);
|
||||||
case DifferentialAction::ACTION_RESIGN:
|
case DifferentialAction::ACTION_RESIGN:
|
||||||
|
@ -139,6 +140,7 @@ final class DifferentialTransactionEditor
|
||||||
|
|
||||||
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
||||||
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
|
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
|
||||||
|
$status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case PhabricatorTransactions::TYPE_VIEW_POLICY:
|
case PhabricatorTransactions::TYPE_VIEW_POLICY:
|
||||||
|
@ -169,7 +171,7 @@ final class DifferentialTransactionEditor
|
||||||
$object->setStatus(ArcanistDifferentialRevisionStatus::ABANDONED);
|
$object->setStatus(ArcanistDifferentialRevisionStatus::ABANDONED);
|
||||||
return;
|
return;
|
||||||
case DifferentialAction::ACTION_RETHINK:
|
case DifferentialAction::ACTION_RETHINK:
|
||||||
$object->setStatus($status_revision);
|
$object->setStatus($status_plan);
|
||||||
return;
|
return;
|
||||||
case DifferentialAction::ACTION_RECLAIM:
|
case DifferentialAction::ACTION_RECLAIM:
|
||||||
$object->setStatus($status_review);
|
$object->setStatus($status_review);
|
||||||
|
@ -714,7 +716,7 @@ final class DifferentialTransactionEditor
|
||||||
if (!$actor_is_author) {
|
if (!$actor_is_author) {
|
||||||
return pht(
|
return pht(
|
||||||
"You can not plan changes to this revision because you do not ".
|
"You can not plan changes to this revision because you do not ".
|
||||||
"own it. To plan chagnes to a revision, you must be its owner.");
|
"own it. To plan changes to a revision, you must be its owner.");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($revision_status) {
|
switch ($revision_status) {
|
||||||
|
@ -723,6 +725,9 @@ final class DifferentialTransactionEditor
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||||
// These are OK.
|
// These are OK.
|
||||||
break;
|
break;
|
||||||
|
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
|
||||||
|
// Let this through, it's a no-op.
|
||||||
|
break;
|
||||||
case ArcanistDifferentialRevisionStatus::ABANDONED:
|
case ArcanistDifferentialRevisionStatus::ABANDONED:
|
||||||
return pht(
|
return pht(
|
||||||
"You can not plan changes to this revision because it has ".
|
"You can not plan changes to this revision because it has ".
|
||||||
|
@ -752,6 +757,7 @@ final class DifferentialTransactionEditor
|
||||||
switch ($revision_status) {
|
switch ($revision_status) {
|
||||||
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
||||||
|
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
|
||||||
// These are OK.
|
// These are OK.
|
||||||
break;
|
break;
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||||
|
|
|
@ -182,6 +182,7 @@ final class DifferentialRevisionListView extends AphrontView {
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
|
||||||
break;
|
break;
|
||||||
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
|
||||||
|
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
|
||||||
$item->setBarColor('red');
|
$item->setBarColor('red');
|
||||||
break;
|
break;
|
||||||
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
||||||
|
|
Loading…
Reference in a new issue