Path: blob/master/src/applications/differential/xaction/DifferentialRevisionReopenTransaction.php
12256 views
<?php12final class DifferentialRevisionReopenTransaction3extends DifferentialRevisionActionTransaction {45const TRANSACTIONTYPE = 'differential.revision.reopen';6const ACTIONKEY = 'reopen';78protected function getRevisionActionLabel(9DifferentialRevision $revision,10PhabricatorUser $viewer) {11return pht('Reopen Revision');12}1314protected function getRevisionActionDescription(15DifferentialRevision $revision,16PhabricatorUser $viewer) {17return pht('This revision will be reopened for review.');18}1920public function getIcon() {21return 'fa-bullhorn';22}2324public function getColor() {25return 'sky';26}2728protected function getRevisionActionOrder() {29return 400;30}3132public function getActionName() {33return pht('Reopened');34}3536public function generateOldValue($object) {37return !$object->isClosed();38}3940public function applyInternalEffects($object, $value) {41$status_review = DifferentialRevisionStatus::NEEDS_REVIEW;42$object->setModernRevisionStatus($status_review);43}4445protected function validateAction($object, PhabricatorUser $viewer) {46if (!$object->isPublished()) {47throw new Exception(48pht(49'You can not reopen this revision because it is not closed. '.50'Only closed revisions can be reopened.'));51}5253$config_key = 'differential.allow-reopen';54if (!PhabricatorEnv::getEnvConfig($config_key)) {55throw new Exception(56pht(57'You can not reopen this revision because configuration prevents '.58'any revision from being reopened. You can change this behavior '.59'by adjusting the "%s" setting in Config.',60$config_key));61}62}6364public function getTitle() {65return pht(66'%s reopened this revision.',67$this->renderAuthor());68}6970public function getTitleForFeed() {71return pht(72'%s reopened %s.',73$this->renderAuthor(),74$this->renderObject());75}7677public function getTransactionTypeForConduit($xaction) {78return 'reopen';79}8081public function getFieldValuesForConduit($object, $data) {82return array();83}8485}868788