Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/differential/xaction/DifferentialRevisionHoldDraftTransaction.php b/src/applications/differential/xaction/DifferentialRevisionHoldDraftTransaction.php
index 5bc257ab62..2562f18209 100644
--- a/src/applications/differential/xaction/DifferentialRevisionHoldDraftTransaction.php
+++ b/src/applications/differential/xaction/DifferentialRevisionHoldDraftTransaction.php
@@ -1,47 +1,56 @@
<?php
final class DifferentialRevisionHoldDraftTransaction
extends DifferentialRevisionTransactionType {
const TRANSACTIONTYPE = 'draft';
const EDITKEY = 'draft';
public function generateOldValue($object) {
return (bool)$object->getHoldAsDraft();
}
public function generateNewValue($object, $value) {
return (bool)$value;
}
public function applyInternalEffects($object, $value) {
$object->setHoldAsDraft($value);
+
+ // If draft isn't the default state but we're creating a new revision
+ // and holding it as a draft, put it in draft mode. See PHI206.
+ // TODO: This can probably be removed once Draft is the universal default.
+ if ($this->isNewObject()) {
+ if ($object->isNeedsReview()) {
+ $object->setModernRevisionStatus(DifferentialRevisionStatus::DRAFT);
+ }
+ }
}
public function getTitle() {
if ($this->getNewValue()) {
return pht(
'%s held this revision as a draft.',
$this->renderAuthor());
} else {
return pht(
'%s set this revision to automatically submit once builds complete.',
$this->renderAuthor());
}
}
public function getTitleForFeed() {
if ($this->getNewValue()) {
return pht(
'%s held %s as a draft.',
$this->renderAuthor(),
$this->renderObject());
} else {
return pht(
'%s set %s to automatically submit once builds complete.',
$this->renderAuthor(),
$this->renderObject());
}
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Apr 30, 12:58 AM (1 d, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
108500
Default Alt Text
(1 KB)

Event Timeline