3 final class DifferentialRevisionHoldDraftTransaction
4 extends DifferentialRevisionTransactionType
{
6 const TRANSACTIONTYPE
= 'draft';
7 const EDITKEY
= 'draft';
9 public function generateOldValue($object) {
10 return (bool)$object->getHoldAsDraft();
13 public function generateNewValue($object, $value) {
17 public function applyInternalEffects($object, $value) {
18 $object->setHoldAsDraft($value);
20 // If draft isn't the default state but we're creating a new revision
21 // and holding it as a draft, put it in draft mode. See PHI206.
22 // TODO: This can probably be removed once Draft is the universal default.
23 if ($this->isNewObject()) {
24 if ($object->isNeedsReview()) {
26 ->setModernRevisionStatus(DifferentialRevisionStatus
::DRAFT
)
27 ->setShouldBroadcast(false);
32 public function getTitle() {
33 if ($this->getNewValue()) {
35 '%s held this revision as a draft.',
36 $this->renderAuthor());
39 '%s set this revision to automatically submit once builds complete.',
40 $this->renderAuthor());
44 public function getTitleForFeed() {
45 if ($this->getNewValue()) {
47 '%s held %s as a draft.',
48 $this->renderAuthor(),
49 $this->renderObject());
52 '%s set %s to automatically submit once builds complete.',
53 $this->renderAuthor(),
54 $this->renderObject());
58 public function getTransactionTypeForConduit($xaction) {
62 public function getFieldValuesForConduit($xaction, $data) {
64 'old' => $xaction->getOldValue(),
65 'new' => $xaction->getNewValue(),