Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / xaction / DiffusionCommitConcernTransaction.php
blob8f2744f21d75a6ee3fee0a9d65aa3d41d00f14d0
1 <?php
3 final class DiffusionCommitConcernTransaction
4 extends DiffusionCommitAuditTransaction {
6 const TRANSACTIONTYPE = 'diffusion.commit.concern';
7 const ACTIONKEY = 'concern';
9 protected function getCommitActionLabel() {
10 return pht('Raise Concern');
13 protected function getCommitActionDescription() {
14 return pht('This commit will be returned to the author for consideration.');
17 public function getIcon() {
18 return 'fa-times-circle-o';
21 public function getColor() {
22 return 'red';
25 protected function getCommitActionOrder() {
26 return 600;
29 public function getActionName() {
30 return pht('Raised Concern');
33 public function applyInternalEffects($object, $value) {
34 // NOTE: We force the commit directly into "Concern Raised" so that we
35 // override a possible "Needs Verification" state.
36 $object->setAuditStatus(DiffusionCommitAuditStatus::CONCERN_RAISED);
39 public function applyExternalEffects($object, $value) {
40 $status = PhabricatorAuditRequestStatus::CONCERNED;
41 $actor = $this->getActor();
42 $this->applyAuditorEffect($object, $actor, $value, $status);
45 protected function validateAction($object, PhabricatorUser $viewer) {
46 if ($this->isViewerCommitAuthor($object, $viewer)) {
47 throw new Exception(
48 pht(
49 'You can not raise a concern with this commit because you are '.
50 'the commit author. You can only raise concerns with commits '.
51 'you did not author.'));
54 // Even if you've already raised a concern, you can raise again as long
55 // as the author requested you verify.
56 if ($this->isViewerFullyRejected($object, $viewer)) {
57 if (!$object->isAuditStatusNeedsVerification()) {
58 throw new Exception(
59 pht(
60 'You can not raise a concern with this commit because you have '.
61 'already raised a concern with it.'));
66 public function getTitle() {
67 return pht(
68 '%s raised a concern with this commit.',
69 $this->renderAuthor());
72 public function getTitleForFeed() {
73 return pht(
74 '%s raised a concern with %s.',
75 $this->renderAuthor(),
76 $this->renderObject());
79 public function getTransactionTypeForConduit($xaction) {
80 return 'concern';
83 public function getFieldValuesForConduit($object, $data) {
84 return array();