2016-12-28 22:05:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialRevisionReopenTransaction
|
|
|
|
extends DifferentialRevisionActionTransaction {
|
|
|
|
|
|
|
|
const TRANSACTIONTYPE = 'differential.revision.reopen';
|
|
|
|
const ACTIONKEY = 'reopen';
|
|
|
|
|
|
|
|
protected function getRevisionActionLabel() {
|
|
|
|
return pht('Reopen Revision');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getRevisionActionDescription() {
|
|
|
|
return pht('This revision will be reopened for review.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon() {
|
|
|
|
return 'fa-bullhorn';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColor() {
|
|
|
|
return 'sky';
|
|
|
|
}
|
|
|
|
|
Order actions sensibly within Differential revision comment action groups
Summary:
Ref T11114. See D17114 for some discussion.
For review actions: accept, reject, resign.
For revision actions, order is basically least-severe to most-severe action pairs: plan changes, request review, close, reopen, abandon, reclaim, commandeer.
Test Plan: Viewed revisions as an author and a reviewer, saw sensible action order within action groups.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T11114
Differential Revision: https://secure.phabricator.com/D17115
2016-12-29 22:36:36 +01:00
|
|
|
protected function getRevisionActionOrder() {
|
|
|
|
return 400;
|
|
|
|
}
|
|
|
|
|
2017-01-12 16:40:48 +01:00
|
|
|
public function getActionName() {
|
|
|
|
return pht('Reopened');
|
|
|
|
}
|
|
|
|
|
2016-12-28 22:05:04 +01:00
|
|
|
public function generateOldValue($object) {
|
|
|
|
return !$object->isClosed();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
|
|
$object->setStatus(ArcanistDifferentialRevisionStatus::NEEDS_REVIEW);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function validateAction($object, PhabricatorUser $viewer) {
|
|
|
|
// Note that we're testing for "Closed", exactly, not just any closed
|
|
|
|
// status.
|
|
|
|
$status_closed = ArcanistDifferentialRevisionStatus::CLOSED;
|
|
|
|
if ($object->getStatus() != $status_closed) {
|
|
|
|
throw new Exception(
|
|
|
|
pht(
|
|
|
|
'You can not reopen this revision because it is not closed. '.
|
|
|
|
'Only closed revisions can be reopened.'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$config_key = 'differential.allow-reopen';
|
|
|
|
if (!PhabricatorEnv::getEnvConfig($config_key)) {
|
|
|
|
throw new Exception(
|
|
|
|
pht(
|
|
|
|
'You can not reopen this revision because configuration prevents '.
|
|
|
|
'any revision from being reopened. You can change this behavior '.
|
|
|
|
'by adjusting the "%s" setting in Config.',
|
|
|
|
$config_key));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
return pht(
|
|
|
|
'%s reopened this revision.',
|
|
|
|
$this->renderAuthor());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
|
|
|
return pht(
|
|
|
|
'%s reopened %s.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|