mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Align most revision actions to the new "Draft" state
Summary: Ref T2543. Most actions are not available for drafts. Authors can "Request Review" (move out of draft to become a normal revision) or "Abandon". Non-authors can't do anything (maybe we'll let them do something later -- like "Commandeer"? -- if there's a good reason). Test Plan: Viewed a draft revision as an author and non-author, saw fewer actions available. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T2543 Differential Revision: https://secure.phabricator.com/D18626
This commit is contained in:
parent
5112dac491
commit
c7af663523
11 changed files with 48 additions and 13 deletions
|
@ -10,7 +10,8 @@ final class DifferentialRevisionAbandonTransaction
|
|||
return pht('Abandon Revision');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('This revision will be abandoned and closed.');
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionAcceptTransaction
|
|||
return pht("Accept Revision \xE2\x9C\x94");
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('These changes will be approved.');
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ abstract class DifferentialRevisionActionTransaction
|
|||
return DifferentialRevisionEditEngine::ACTIONGROUP_REVISION;
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -103,7 +104,7 @@ abstract class DifferentialRevisionActionTransaction
|
|||
if ($label !== null) {
|
||||
$field->setCommentActionLabel($label);
|
||||
|
||||
$description = $this->getRevisionActionDescription();
|
||||
$description = $this->getRevisionActionDescription($revision);
|
||||
$field->setActionDescription($description);
|
||||
|
||||
$group_key = $this->getRevisionActionGroupKey();
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionCloseTransaction
|
|||
return pht('Close Revision');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('This revision will be closed.');
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionCommandeerTransaction
|
|||
return pht('Commandeer Revision');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('You will take control of this revision and become its author.');
|
||||
}
|
||||
|
||||
|
@ -65,6 +66,11 @@ final class DifferentialRevisionCommandeerTransaction
|
|||
'been closed. You can only commandeer open revisions.'));
|
||||
}
|
||||
|
||||
if ($object->isDraft()) {
|
||||
throw new Exception(
|
||||
pht('You can not commandeer a draft revision.'));
|
||||
}
|
||||
|
||||
if ($this->isViewerRevisionAuthor($object, $viewer)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionPlanChangesTransaction
|
|||
return pht('Plan Changes');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht(
|
||||
'This revision will be removed from review queues until it is revised.');
|
||||
}
|
||||
|
@ -55,6 +56,11 @@ final class DifferentialRevisionPlanChangesTransaction
|
|||
}
|
||||
|
||||
protected function validateAction($object, PhabricatorUser $viewer) {
|
||||
if ($object->isDraft()) {
|
||||
throw new Exception(
|
||||
pht('You can not plan changes to a draft revision.'));
|
||||
}
|
||||
|
||||
if ($object->isChangePlanned()) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionReclaimTransaction
|
|||
return pht('Reclaim Revision');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('This revision will be reclaimed and reopened.');
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionRejectTransaction
|
|||
return pht("Request Changes \xE2\x9C\x98");
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('This revision will be returned to the author for updates.');
|
||||
}
|
||||
|
||||
|
@ -72,6 +73,11 @@ final class DifferentialRevisionRejectTransaction
|
|||
'not own.'));
|
||||
}
|
||||
|
||||
if ($object->isDraft()) {
|
||||
throw new Exception(
|
||||
pht('You can not request changes to a draft revision.'));
|
||||
}
|
||||
|
||||
if ($this->isViewerFullyRejected($object, $viewer)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionReopenTransaction
|
|||
return pht('Reopen Revision');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('This revision will be reopened for review.');
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,14 @@ final class DifferentialRevisionRequestReviewTransaction
|
|||
return pht('Request Review');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
if ($revision->isDraft()) {
|
||||
return pht('This revision will be submitted to reviewers for feedback.');
|
||||
} else {
|
||||
return pht('This revision will be returned to reviewers for feedback.');
|
||||
}
|
||||
}
|
||||
|
||||
public function getColor() {
|
||||
return 'sky';
|
||||
|
|
|
@ -10,7 +10,8 @@ final class DifferentialRevisionResignTransaction
|
|||
return pht('Resign as Reviewer');
|
||||
}
|
||||
|
||||
protected function getRevisionActionDescription() {
|
||||
protected function getRevisionActionDescription(
|
||||
DifferentialRevision $revision) {
|
||||
return pht('You will resign as a reviewer for this change.');
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,11 @@ final class DifferentialRevisionResignTransaction
|
|||
'been closed. You can only resign from open revisions.'));
|
||||
}
|
||||
|
||||
if ($object->isDraft()) {
|
||||
throw new Exception(
|
||||
pht('You can not resign from a draft revision.'));
|
||||
}
|
||||
|
||||
$resigned = DifferentialReviewerStatus::STATUS_RESIGNED;
|
||||
if ($this->getViewerReviewerStatus($object, $viewer) == $resigned) {
|
||||
throw new Exception(
|
||||
|
|
Loading…
Reference in a new issue