Generate file attachment transactions for explicit Remarkup attachments on common...
[phabricator.git] / src / applications / differential / xaction / DifferentialRevisionRejectTransaction.php
blobcd3e815d2624f6801a2fc3a49add469d2b13c059
1 <?php
3 final class DifferentialRevisionRejectTransaction
4 extends DifferentialRevisionReviewTransaction {
6 const TRANSACTIONTYPE = 'differential.revision.reject';
7 const ACTIONKEY = 'reject';
9 protected function getRevisionActionLabel(
10 DifferentialRevision $revision,
11 PhabricatorUser $viewer) {
12 return pht('Request Changes');
15 protected function getRevisionActionDescription(
16 DifferentialRevision $revision,
17 PhabricatorUser $viewer) {
18 return pht('This revision will be returned to the author for updates.');
21 public function getIcon() {
22 return 'fa-times-circle-o';
25 public function getColor() {
26 return 'red';
29 protected function getRevisionActionOrder() {
30 return 600;
33 public function getActionName() {
34 return pht('Requested Changes');
37 public function getCommandKeyword() {
38 return 'request';
41 public function getCommandAliases() {
42 return array(
43 'reject',
47 public function getCommandSummary() {
48 return pht('Request changes to a revision.');
51 public function generateOldValue($object) {
52 $actor = $this->getActor();
53 return $this->isViewerFullyRejected($object, $actor);
56 public function applyExternalEffects($object, $value) {
57 $status = DifferentialReviewerStatus::STATUS_REJECTED;
58 $actor = $this->getActor();
59 $this->applyReviewerEffect($object, $actor, $value, $status);
62 protected function validateAction($object, PhabricatorUser $viewer) {
63 if ($object->isClosed()) {
64 throw new Exception(
65 pht(
66 'You can not request changes to this revision because it has '.
67 'already been closed. You can only request changes to open '.
68 'revisions.'));
71 if ($this->isViewerRevisionAuthor($object, $viewer)) {
72 throw new Exception(
73 pht(
74 'You can not request changes to this revision because you are the '.
75 'revision author. You can only request changes to revisions you do '.
76 'not own.'));
79 if ($object->isDraft() || !$object->getShouldBroadcast()) {
80 throw new Exception(
81 pht('You can not request changes to a draft revision.'));
84 if ($this->isViewerFullyRejected($object, $viewer)) {
85 throw new Exception(
86 pht(
87 'You can not request changes to this revision because you have '.
88 'already requested changes.'));
92 public function getTitle() {
93 return pht(
94 '%s requested changes to this revision.',
95 $this->renderAuthor());
98 public function getTitleForFeed() {
99 return pht(
100 '%s requested changes to %s.',
101 $this->renderAuthor(),
102 $this->renderObject());
105 public function getTransactionTypeForConduit($xaction) {
106 return 'request-changes';
109 public function getFieldValuesForConduit($object, $data) {
110 return array();