Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php
12241 views
1
<?php
2
3
final 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
public function getIcon() {
18
return 'fa-flag';
19
}
20
21
public function getColor() {
22
return 'orange';
23
}
24
25
protected function getCommitActionOrder() {
26
return 700;
27
}
28
29
public function getActionName() {
30
return pht('Resigned');
31
}
32
33
public function generateOldValue($object) {
34
$actor = $this->getActor();
35
return !$this->isViewerAnyActiveAuditor($object, $actor);
36
}
37
38
public function applyExternalEffects($object, $value) {
39
$status = PhabricatorAuditRequestStatus::RESIGNED;
40
$actor = $this->getActor();
41
$this->applyAuditorEffect($object, $actor, $value, $status);
42
}
43
44
protected function validateAction($object, PhabricatorUser $viewer) {
45
if (!$this->isViewerAnyActiveAuditor($object, $viewer)) {
46
throw new Exception(
47
pht(
48
'You can not resign from this commit because you are not an '.
49
'active auditor.'));
50
}
51
}
52
53
public function getTitle() {
54
return pht(
55
'%s resigned from this commit.',
56
$this->renderAuthor());
57
}
58
59
public function getTitleForFeed() {
60
return pht(
61
'%s resigned from %s.',
62
$this->renderAuthor(),
63
$this->renderObject());
64
}
65
66
public function getTransactionTypeForConduit($xaction) {
67
return 'resign';
68
}
69
70
public function getFieldValuesForConduit($object, $data) {
71
return array();
72
}
73
74
}
75
76