1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-15 18:10:53 +01:00

(stable) Don't downgrade accepts on update (fix "sticky accept")

Summary:
Fixes T12496. Sticky accept was accidentally impacted by the "void" changes in D17566.

Instead, don't always downgrade all accepts/rejects: on update, we only want to downgrade accepts.

Test Plan:
  - With sticky accept off, updated an accepted revision: new state is "needs review".
  - With sticky accept on, updated an accepted revision: new state is "accepted" (sticky accept working correctly).
  - Did "reject" + "request review" to make sure that still works, worked fine.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12496

Differential Revision: https://secure.phabricator.com/D17605
This commit is contained in:
epriestley 2017-04-03 08:35:29 -07:00
parent 2460755603
commit 520d3b9392
2 changed files with 15 additions and 5 deletions

View file

@ -339,12 +339,22 @@ final class DifferentialTransactionEditor
} }
} }
if ($downgrade_accepts || $downgrade_rejects) { $downgrade = array();
if ($downgrade_accepts) {
$downgrade[] = DifferentialReviewerStatus::STATUS_ACCEPTED;
}
if ($downgrade_accepts) {
$downgrade[] = DifferentialReviewerStatus::STATUS_REJECTED;
}
if ($downgrade) {
$void_type = DifferentialRevisionVoidTransaction::TRANSACTIONTYPE; $void_type = DifferentialRevisionVoidTransaction::TRANSACTIONTYPE;
$results[] = id(new DifferentialTransaction()) $results[] = id(new DifferentialTransaction())
->setTransactionType($void_type) ->setTransactionType($void_type)
->setIgnoreOnNoEffect(true) ->setIgnoreOnNoEffect(true)
->setNewValue(true); ->setNewValue($downgrade);
} }
$is_commandeer = false; $is_commandeer = false;

View file

@ -28,7 +28,7 @@ final class DifferentialRevisionVoidTransaction
AND reviewerStatus IN (%Ls)', AND reviewerStatus IN (%Ls)',
$table_name, $table_name,
$object->getPHID(), $object->getPHID(),
$this->getVoidableStatuses()); $value);
return ipull($rows, 'reviewerPHID'); return ipull($rows, 'reviewerPHID');
} }
@ -47,11 +47,11 @@ final class DifferentialRevisionVoidTransaction
'UPDATE %T SET voidedPHID = %s 'UPDATE %T SET voidedPHID = %s
WHERE revisionPHID = %s WHERE revisionPHID = %s
AND voidedPHID IS NULL AND voidedPHID IS NULL
AND reviewerStatus IN (%Ls)', AND reviewerPHID IN (%Ls)',
$table_name, $table_name,
$this->getActingAsPHID(), $this->getActingAsPHID(),
$object->getPHID(), $object->getPHID(),
$this->getVoidableStatuses()); $value);
} }
public function shouldHide() { public function shouldHide() {