mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Restore "Plan Changes" and "Request Review" actions to Differential on EditEngine
Summary: Ref T11114. This restores these actions. One behavior is incomplete: "Request Review" on an accepted revision does not downgrade reviewers properly. I've noted this locally. Test Plan: Planned changes and requested review of a revision. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17109
This commit is contained in:
parent
a90ab7f403
commit
deb19b2d57
3 changed files with 149 additions and 0 deletions
|
@ -541,6 +541,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionPHIDType' => 'applications/differential/phid/DifferentialRevisionPHIDType.php',
|
'DifferentialRevisionPHIDType' => 'applications/differential/phid/DifferentialRevisionPHIDType.php',
|
||||||
'DifferentialRevisionPackageHeraldField' => 'applications/differential/herald/DifferentialRevisionPackageHeraldField.php',
|
'DifferentialRevisionPackageHeraldField' => 'applications/differential/herald/DifferentialRevisionPackageHeraldField.php',
|
||||||
'DifferentialRevisionPackageOwnerHeraldField' => 'applications/differential/herald/DifferentialRevisionPackageOwnerHeraldField.php',
|
'DifferentialRevisionPackageOwnerHeraldField' => 'applications/differential/herald/DifferentialRevisionPackageOwnerHeraldField.php',
|
||||||
|
'DifferentialRevisionPlanChangesTransaction' => 'applications/differential/xaction/DifferentialRevisionPlanChangesTransaction.php',
|
||||||
'DifferentialRevisionQuery' => 'applications/differential/query/DifferentialRevisionQuery.php',
|
'DifferentialRevisionQuery' => 'applications/differential/query/DifferentialRevisionQuery.php',
|
||||||
'DifferentialRevisionReclaimTransaction' => 'applications/differential/xaction/DifferentialRevisionReclaimTransaction.php',
|
'DifferentialRevisionReclaimTransaction' => 'applications/differential/xaction/DifferentialRevisionReclaimTransaction.php',
|
||||||
'DifferentialRevisionRelationship' => 'applications/differential/relationships/DifferentialRevisionRelationship.php',
|
'DifferentialRevisionRelationship' => 'applications/differential/relationships/DifferentialRevisionRelationship.php',
|
||||||
|
@ -549,6 +550,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionRepositoryHeraldField' => 'applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php',
|
'DifferentialRevisionRepositoryHeraldField' => 'applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php',
|
||||||
'DifferentialRevisionRepositoryProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php',
|
'DifferentialRevisionRepositoryProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php',
|
||||||
'DifferentialRevisionRepositoryTransaction' => 'applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php',
|
'DifferentialRevisionRepositoryTransaction' => 'applications/differential/xaction/DifferentialRevisionRepositoryTransaction.php',
|
||||||
|
'DifferentialRevisionRequestReviewTransaction' => 'applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php',
|
||||||
'DifferentialRevisionRequiredActionResultBucket' => 'applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php',
|
'DifferentialRevisionRequiredActionResultBucket' => 'applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php',
|
||||||
'DifferentialRevisionResultBucket' => 'applications/differential/query/DifferentialRevisionResultBucket.php',
|
'DifferentialRevisionResultBucket' => 'applications/differential/query/DifferentialRevisionResultBucket.php',
|
||||||
'DifferentialRevisionReviewersHeraldField' => 'applications/differential/herald/DifferentialRevisionReviewersHeraldField.php',
|
'DifferentialRevisionReviewersHeraldField' => 'applications/differential/herald/DifferentialRevisionReviewersHeraldField.php',
|
||||||
|
@ -5212,6 +5214,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionPHIDType' => 'PhabricatorPHIDType',
|
'DifferentialRevisionPHIDType' => 'PhabricatorPHIDType',
|
||||||
'DifferentialRevisionPackageHeraldField' => 'DifferentialRevisionHeraldField',
|
'DifferentialRevisionPackageHeraldField' => 'DifferentialRevisionHeraldField',
|
||||||
'DifferentialRevisionPackageOwnerHeraldField' => 'DifferentialRevisionHeraldField',
|
'DifferentialRevisionPackageOwnerHeraldField' => 'DifferentialRevisionHeraldField',
|
||||||
|
'DifferentialRevisionPlanChangesTransaction' => 'DifferentialRevisionActionTransaction',
|
||||||
'DifferentialRevisionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DifferentialRevisionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'DifferentialRevisionReclaimTransaction' => 'DifferentialRevisionActionTransaction',
|
'DifferentialRevisionReclaimTransaction' => 'DifferentialRevisionActionTransaction',
|
||||||
'DifferentialRevisionRelationship' => 'PhabricatorObjectRelationship',
|
'DifferentialRevisionRelationship' => 'PhabricatorObjectRelationship',
|
||||||
|
@ -5220,6 +5223,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionRepositoryHeraldField' => 'DifferentialRevisionHeraldField',
|
'DifferentialRevisionRepositoryHeraldField' => 'DifferentialRevisionHeraldField',
|
||||||
'DifferentialRevisionRepositoryProjectsHeraldField' => 'DifferentialRevisionHeraldField',
|
'DifferentialRevisionRepositoryProjectsHeraldField' => 'DifferentialRevisionHeraldField',
|
||||||
'DifferentialRevisionRepositoryTransaction' => 'DifferentialRevisionTransactionType',
|
'DifferentialRevisionRepositoryTransaction' => 'DifferentialRevisionTransactionType',
|
||||||
|
'DifferentialRevisionRequestReviewTransaction' => 'DifferentialRevisionActionTransaction',
|
||||||
'DifferentialRevisionRequiredActionResultBucket' => 'DifferentialRevisionResultBucket',
|
'DifferentialRevisionRequiredActionResultBucket' => 'DifferentialRevisionResultBucket',
|
||||||
'DifferentialRevisionResultBucket' => 'PhabricatorSearchResultBucket',
|
'DifferentialRevisionResultBucket' => 'PhabricatorSearchResultBucket',
|
||||||
'DifferentialRevisionReviewersHeraldField' => 'DifferentialRevisionHeraldField',
|
'DifferentialRevisionReviewersHeraldField' => 'DifferentialRevisionHeraldField',
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DifferentialRevisionPlanChangesTransaction
|
||||||
|
extends DifferentialRevisionActionTransaction {
|
||||||
|
|
||||||
|
const TRANSACTIONTYPE = 'differential.revision.plan';
|
||||||
|
const ACTIONKEY = 'plan-changes';
|
||||||
|
|
||||||
|
protected function getRevisionActionLabel() {
|
||||||
|
return pht('Plan Changes');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getRevisionActionDescription() {
|
||||||
|
return pht(
|
||||||
|
'This revision will be removed from review queues until it is revised.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIcon() {
|
||||||
|
return 'fa-headphones';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColor() {
|
||||||
|
return 'red';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateOldValue($object) {
|
||||||
|
$status_planned = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
|
||||||
|
return ($object->getStatus() == $status_planned);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyInternalEffects($object, $value) {
|
||||||
|
$status_planned = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
|
||||||
|
$object->setStatus($status_planned);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function validateAction($object, PhabricatorUser $viewer) {
|
||||||
|
$status_planned = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
|
||||||
|
|
||||||
|
if ($object->getStatus() == $status_planned) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'You can not request review of this revision because this '.
|
||||||
|
'revision is already under review and the action would have '.
|
||||||
|
'no effect.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($object->isClosed()) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'You can not plan changes to this this revision because it has '.
|
||||||
|
'already been closed.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->isViewerRevisionAuthor($object, $viewer)) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'You can not plan changes to this revision because you do not '.
|
||||||
|
'own it. Only the author of a revision can plan changes to it.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
return pht(
|
||||||
|
'%s planned changes to this revision.',
|
||||||
|
$this->renderAuthor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
return pht(
|
||||||
|
'%s planned changes to %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DifferentialRevisionRequestReviewTransaction
|
||||||
|
extends DifferentialRevisionActionTransaction {
|
||||||
|
|
||||||
|
const TRANSACTIONTYPE = 'differential.revision.request';
|
||||||
|
const ACTIONKEY = 'request-review';
|
||||||
|
|
||||||
|
protected function getRevisionActionLabel() {
|
||||||
|
return pht('Request Review');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getRevisionActionDescription() {
|
||||||
|
return pht('This revision will be returned to reviewers for feedback.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColor() {
|
||||||
|
return 'sky';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateOldValue($object) {
|
||||||
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
||||||
|
return ($object->getStatus() == $status_review);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyInternalEffects($object, $value) {
|
||||||
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
||||||
|
$object->setStatus($status_review);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function validateAction($object, PhabricatorUser $viewer) {
|
||||||
|
$status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
|
||||||
|
if ($object->getStatus() == $status_review) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'You can not request review of this revision because this '.
|
||||||
|
'revision is already under review and the action would have '.
|
||||||
|
'no effect.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($object->isClosed()) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'You can not request review of this revision because it has '.
|
||||||
|
'already been closed. You can only request review of open '.
|
||||||
|
'revisions.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->isViewerRevisionAuthor($object, $viewer)) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'You can not request review of this revision because you are not '.
|
||||||
|
'the author of the revision.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
return pht(
|
||||||
|
'%s requested review of this revision.',
|
||||||
|
$this->renderAuthor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
return pht(
|
||||||
|
'%s requested review of %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue