Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/xaction/DiffusionCommitConcernTransaction.php
12241 views
1
<?php
2
3
final class DiffusionCommitConcernTransaction
4
extends DiffusionCommitAuditTransaction {
5
6
const TRANSACTIONTYPE = 'diffusion.commit.concern';
7
const ACTIONKEY = 'concern';
8
9
protected function getCommitActionLabel() {
10
return pht('Raise Concern');
11
}
12
13
protected function getCommitActionDescription() {
14
return pht('This commit will be returned to the author for consideration.');
15
}
16
17
public function getIcon() {
18
return 'fa-times-circle-o';
19
}
20
21
public function getColor() {
22
return 'red';
23
}
24
25
protected function getCommitActionOrder() {
26
return 600;
27
}
28
29
public function getActionName() {
30
return pht('Raised Concern');
31
}
32
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);
37
}
38
39
public function applyExternalEffects($object, $value) {
40
$status = PhabricatorAuditRequestStatus::CONCERNED;
41
$actor = $this->getActor();
42
$this->applyAuditorEffect($object, $actor, $value, $status);
43
}
44
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.'));
52
}
53
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.'));
62
}
63
}
64
}
65
66
public function getTitle() {
67
return pht(
68
'%s raised a concern with this commit.',
69
$this->renderAuthor());
70
}
71
72
public function getTitleForFeed() {
73
return pht(
74
'%s raised a concern with %s.',
75
$this->renderAuthor(),
76
$this->renderObject());
77
}
78
79
public function getTransactionTypeForConduit($xaction) {
80
return 'concern';
81
}
82
83
public function getFieldValuesForConduit($object, $data) {
84
return array();
85
}
86
87
}
88
89