Path: blob/master/src/applications/diffusion/xaction/DiffusionCommitAcceptTransaction.php
12241 views
<?php12final class DiffusionCommitAcceptTransaction3extends DiffusionCommitAuditTransaction {45const TRANSACTIONTYPE = 'diffusion.commit.accept';6const ACTIONKEY = 'accept';78protected function getCommitActionLabel() {9return pht('Accept Commit');10}1112protected function getCommitActionDescription() {13return pht('This commit will be approved.');14}1516public function getIcon() {17return 'fa-check-circle-o';18}1920public function getColor() {21return 'green';22}2324protected function getCommitActionOrder() {25return 500;26}2728public function getActionName() {29return pht('Accepted');30}3132public function applyExternalEffects($object, $value) {33$status = PhabricatorAuditRequestStatus::ACCEPTED;34$actor = $this->getActor();35$this->applyAuditorEffect($object, $actor, $value, $status);36}3738protected function validateAction($object, PhabricatorUser $viewer) {39$config_key = 'audit.can-author-close-audit';40if (!PhabricatorEnv::getEnvConfig($config_key)) {41if ($this->isViewerCommitAuthor($object, $viewer)) {42throw new Exception(43pht(44'You can not accept this commit because you are the commit '.45'author. You can only accept commits you did not author. You can '.46'change this behavior by adjusting the "%s" setting in Config.',47$config_key));48}49}5051if ($this->isViewerFullyAccepted($object, $viewer)) {52throw new Exception(53pht(54'You can not accept this commit because you have already '.55'accepted it.'));56}57}5859public function getTitle() {60return pht(61'%s accepted this commit.',62$this->renderAuthor());63}6465public function getTitleForFeed() {66return pht(67'%s accepted %s.',68$this->renderAuthor(),69$this->renderObject());70}7172public function getTransactionTypeForConduit($xaction) {73return 'accept';74}7576public function getFieldValuesForConduit($object, $data) {77return array();78}7980}818283