Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/herald/editor/HeraldRuleEditor.php
12256 views
1
<?php
2
3
final class HeraldRuleEditor
4
extends PhabricatorApplicationTransactionEditor {
5
6
public function getEditorApplicationClass() {
7
return 'PhabricatorHeraldApplication';
8
}
9
10
public function getEditorObjectsDescription() {
11
return pht('Herald Rules');
12
}
13
14
protected function shouldApplyHeraldRules(
15
PhabricatorLiskDAO $object,
16
array $xactions) {
17
return true;
18
}
19
20
protected function buildHeraldAdapter(
21
PhabricatorLiskDAO $object,
22
array $xactions) {
23
return id(new HeraldRuleAdapter())
24
->setRule($object);
25
}
26
27
protected function shouldSendMail(
28
PhabricatorLiskDAO $object,
29
array $xactions) {
30
return true;
31
}
32
33
public function getTransactionTypes() {
34
$types = parent::getTransactionTypes();
35
$types[] = PhabricatorTransactions::TYPE_EDGE;
36
return $types;
37
}
38
39
protected function getMailTo(PhabricatorLiskDAO $object) {
40
$phids = array();
41
42
$phids[] = $this->getActingAsPHID();
43
44
if ($object->isPersonalRule()) {
45
$phids[] = $object->getAuthorPHID();
46
}
47
48
return $phids;
49
}
50
51
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
52
return id(new HeraldRuleReplyHandler())
53
->setMailReceiver($object);
54
}
55
56
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
57
$monogram = $object->getMonogram();
58
$name = $object->getName();
59
60
$subject = pht('%s: %s', $monogram, $name);
61
62
return id(new PhabricatorMetaMTAMail())
63
->setSubject($subject);
64
}
65
66
protected function getMailSubjectPrefix() {
67
return pht('[Herald]');
68
}
69
70
protected function buildMailBody(
71
PhabricatorLiskDAO $object,
72
array $xactions) {
73
74
$body = parent::buildMailBody($object, $xactions);
75
76
$body->addLinkSection(
77
pht('RULE DETAIL'),
78
PhabricatorEnv::getProductionURI($object->getURI()));
79
80
return $body;
81
}
82
83
protected function supportsSearch() {
84
return true;
85
}
86
87
}
88
89