Path: blob/master/src/applications/differential/xaction/DifferentialRevisionHoldDraftTransaction.php
12256 views
<?php12final class DifferentialRevisionHoldDraftTransaction3extends DifferentialRevisionTransactionType {45const TRANSACTIONTYPE = 'draft';6const EDITKEY = 'draft';78public function generateOldValue($object) {9return (bool)$object->getHoldAsDraft();10}1112public function generateNewValue($object, $value) {13return (bool)$value;14}1516public function applyInternalEffects($object, $value) {17$object->setHoldAsDraft($value);1819// If draft isn't the default state but we're creating a new revision20// and holding it as a draft, put it in draft mode. See PHI206.21// TODO: This can probably be removed once Draft is the universal default.22if ($this->isNewObject()) {23if ($object->isNeedsReview()) {24$object25->setModernRevisionStatus(DifferentialRevisionStatus::DRAFT)26->setShouldBroadcast(false);27}28}29}3031public function getTitle() {32if ($this->getNewValue()) {33return pht(34'%s held this revision as a draft.',35$this->renderAuthor());36} else {37return pht(38'%s set this revision to automatically submit once builds complete.',39$this->renderAuthor());40}41}4243public function getTitleForFeed() {44if ($this->getNewValue()) {45return pht(46'%s held %s as a draft.',47$this->renderAuthor(),48$this->renderObject());49} else {50return pht(51'%s set %s to automatically submit once builds complete.',52$this->renderAuthor(),53$this->renderObject());54}55}5657public function getTransactionTypeForConduit($xaction) {58return 'draft';59}6061public function getFieldValuesForConduit($xaction, $data) {62return array(63'old' => $xaction->getOldValue(),64'new' => $xaction->getNewValue(),65);66}6768}697071