@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 85 lines 2.0 kB view raw
1<?php 2 3final class DiffusionCommitVerifyTransaction 4 extends DiffusionCommitAuditTransaction { 5 6 const TRANSACTIONTYPE = 'diffusion.commit.verify'; 7 const ACTIONKEY = 'verify'; 8 9 protected function getCommitActionLabel() { 10 return pht('Request Verification'); 11 } 12 13 protected function getCommitActionDescription() { 14 return pht( 15 'Auditors will be asked to verify that concerns have been addressed.'); 16 } 17 18 protected function getCommitActionGroupKey() { 19 return DiffusionCommitEditEngine::ACTIONGROUP_COMMIT; 20 } 21 22 /** 23 * @return string Transaction icon 24 */ 25 public function getIcon() { 26 return 'fa-refresh'; 27 } 28 29 /** 30 * @return string Transaction color 31 */ 32 public function getColor() { 33 return 'indigo'; 34 } 35 36 protected function getCommitActionOrder() { 37 return 600; 38 } 39 40 public function getActionName() { 41 return pht('Requested Verification'); 42 } 43 44 public function applyInternalEffects($object, $value) { 45 $object->setAuditStatus(DiffusionCommitAuditStatus::NEEDS_VERIFICATION); 46 } 47 48 protected function validateAction($object, PhabricatorUser $viewer) { 49 if (!$this->isViewerCommitAuthor($object, $viewer)) { 50 throw new Exception( 51 pht( 52 'You can not request verification of this commit because you '. 53 'are not the author.')); 54 } 55 56 if (!$object->isAuditStatusConcernRaised()) { 57 throw new Exception( 58 pht( 59 'You can not request verification of this commit because no '. 60 'auditors have raised concerns with it.')); 61 } 62 } 63 64 public function getTitle() { 65 return pht( 66 '%s requested verification of this commit.', 67 $this->renderAuthor()); 68 } 69 70 public function getTitleForFeed() { 71 return pht( 72 '%s requested verification of %s.', 73 $this->renderAuthor(), 74 $this->renderObject()); 75 } 76 77 public function getTransactionTypeForConduit($xaction) { 78 return 'request-verification'; 79 } 80 81 public function getFieldValuesForConduit($object, $data) { 82 return array(); 83 } 84 85}