1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Allow "Abandoned" revisions to be commandeered

Summary:
Ref T13216. See PHI985. You currently can't commandeer an abandoned revision, but this workflow is perfectly fine.

The caution here is just around weird use cases where, e.g., users want to reopen a revision to add a revert to it. These workflows tend to create problems so we try to guide users away from them.

Test Plan: {F6026841}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13216

Differential Revision: https://secure.phabricator.com/D19835
This commit is contained in:
epriestley 2018-11-24 06:50:53 -08:00
parent bcc90d8c6b
commit 9473f60a36

View file

@ -59,11 +59,21 @@ final class DifferentialRevisionCommandeerTransaction
}
protected function validateAction($object, PhabricatorUser $viewer) {
if ($object->isClosed()) {
// If a revision has already landed, we generally want to discourage
// reopening and reusing it since this tends to create a big mess (users
// should create a new revision instead). Thus, we stop you from
// commandeering closed revisions.
// See PHI985. If the revision was abandoned, there's no peril in allowing
// the commandeer since the change (likely) never actually landed. So
// it's okay to commandeer abandoned revisions.
if ($object->isClosed() && !$object->isAbandoned()) {
throw new Exception(
pht(
'You can not commandeer this revision because it has already '.
'been closed. You can only commandeer open revisions.'));
'been closed. You can only commandeer open or abandoned '.
'revisions.'));
}
if ($this->isViewerRevisionAuthor($object, $viewer)) {