Generate file attachment transactions for explicit Remarkup attachments on common...
[phabricator.git] / src / applications / differential / xaction / DifferentialRevisionReopenTransaction.php
blob2e7a18fb2248180e7c6e1326fdd6740e81d5810e
1 <?php
3 final class DifferentialRevisionReopenTransaction
4 extends DifferentialRevisionActionTransaction {
6 const TRANSACTIONTYPE = 'differential.revision.reopen';
7 const ACTIONKEY = 'reopen';
9 protected function getRevisionActionLabel(
10 DifferentialRevision $revision,
11 PhabricatorUser $viewer) {
12 return pht('Reopen Revision');
15 protected function getRevisionActionDescription(
16 DifferentialRevision $revision,
17 PhabricatorUser $viewer) {
18 return pht('This revision will be reopened for review.');
21 public function getIcon() {
22 return 'fa-bullhorn';
25 public function getColor() {
26 return 'sky';
29 protected function getRevisionActionOrder() {
30 return 400;
33 public function getActionName() {
34 return pht('Reopened');
37 public function generateOldValue($object) {
38 return !$object->isClosed();
41 public function applyInternalEffects($object, $value) {
42 $status_review = DifferentialRevisionStatus::NEEDS_REVIEW;
43 $object->setModernRevisionStatus($status_review);
46 protected function validateAction($object, PhabricatorUser $viewer) {
47 if (!$object->isPublished()) {
48 throw new Exception(
49 pht(
50 'You can not reopen this revision because it is not closed. '.
51 'Only closed revisions can be reopened.'));
54 $config_key = 'differential.allow-reopen';
55 if (!PhabricatorEnv::getEnvConfig($config_key)) {
56 throw new Exception(
57 pht(
58 'You can not reopen this revision because configuration prevents '.
59 'any revision from being reopened. You can change this behavior '.
60 'by adjusting the "%s" setting in Config.',
61 $config_key));
65 public function getTitle() {
66 return pht(
67 '%s reopened this revision.',
68 $this->renderAuthor());
71 public function getTitleForFeed() {
72 return pht(
73 '%s reopened %s.',
74 $this->renderAuthor(),
75 $this->renderObject());
78 public function getTransactionTypeForConduit($xaction) {
79 return 'reopen';
82 public function getFieldValuesForConduit($object, $data) {
83 return array();