@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
1<?php
2
3final class DiffusionCommitResignTransaction
4 extends DiffusionCommitAuditTransaction {
5
6 const TRANSACTIONTYPE = 'diffusion.commit.resign';
7 const ACTIONKEY = 'resign';
8
9 protected function getCommitActionLabel() {
10 return pht('Resign as Auditor');
11 }
12
13 protected function getCommitActionDescription() {
14 return pht('You will resign as an auditor for this commit.');
15 }
16
17 /**
18 * @return string Transaction icon
19 */
20 public function getIcon() {
21 return 'fa-flag';
22 }
23
24 /**
25 * @return string Transaction color
26 */
27 public function getColor() {
28 return 'orange';
29 }
30
31 protected function getCommitActionOrder() {
32 return 700;
33 }
34
35 public function getActionName() {
36 return pht('Resigned');
37 }
38
39 public function generateOldValue($object) {
40 $actor = $this->getActor();
41 return !$this->isViewerAnyActiveAuditor($object, $actor);
42 }
43
44 public function applyExternalEffects($object, $value) {
45 $status = PhabricatorAuditRequestStatus::RESIGNED;
46 $actor = $this->getActor();
47 $this->applyAuditorEffect($object, $actor, $value, $status);
48 }
49
50 protected function validateAction($object, PhabricatorUser $viewer) {
51 if (!$this->isViewerAnyActiveAuditor($object, $viewer)) {
52 throw new Exception(
53 pht(
54 'You can not resign from this commit because you are not an '.
55 'active auditor.'));
56 }
57 }
58
59 public function getTitle() {
60 return pht(
61 '%s resigned from this commit.',
62 $this->renderAuthor());
63 }
64
65 public function getTitleForFeed() {
66 return pht(
67 '%s resigned from %s.',
68 $this->renderAuthor(),
69 $this->renderObject());
70 }
71
72 public function getTransactionTypeForConduit($xaction) {
73 return 'resign';
74 }
75
76 public function getFieldValuesForConduit($object, $data) {
77 return array();
78 }
79
80}