Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / herald / editor / HeraldRuleEditor.php
blobea099cc6f3fabf4b085402b248c16dcc2186406c
1 <?php
3 final class HeraldRuleEditor
4 extends PhabricatorApplicationTransactionEditor {
6 public function getEditorApplicationClass() {
7 return 'PhabricatorHeraldApplication';
10 public function getEditorObjectsDescription() {
11 return pht('Herald Rules');
14 protected function shouldApplyHeraldRules(
15 PhabricatorLiskDAO $object,
16 array $xactions) {
17 return true;
20 protected function buildHeraldAdapter(
21 PhabricatorLiskDAO $object,
22 array $xactions) {
23 return id(new HeraldRuleAdapter())
24 ->setRule($object);
27 protected function shouldSendMail(
28 PhabricatorLiskDAO $object,
29 array $xactions) {
30 return true;
33 public function getTransactionTypes() {
34 $types = parent::getTransactionTypes();
35 $types[] = PhabricatorTransactions::TYPE_EDGE;
36 return $types;
39 protected function getMailTo(PhabricatorLiskDAO $object) {
40 $phids = array();
42 $phids[] = $this->getActingAsPHID();
44 if ($object->isPersonalRule()) {
45 $phids[] = $object->getAuthorPHID();
48 return $phids;
51 protected function buildReplyHandler(PhabricatorLiskDAO $object) {
52 return id(new HeraldRuleReplyHandler())
53 ->setMailReceiver($object);
56 protected function buildMailTemplate(PhabricatorLiskDAO $object) {
57 $monogram = $object->getMonogram();
58 $name = $object->getName();
60 $subject = pht('%s: %s', $monogram, $name);
62 return id(new PhabricatorMetaMTAMail())
63 ->setSubject($subject);
66 protected function getMailSubjectPrefix() {
67 return pht('[Herald]');
70 protected function buildMailBody(
71 PhabricatorLiskDAO $object,
72 array $xactions) {
74 $body = parent::buildMailBody($object, $xactions);
76 $body->addLinkSection(
77 pht('RULE DETAIL'),
78 PhabricatorEnv::getProductionURI($object->getURI()));
80 return $body;
83 protected function supportsSearch() {
84 return true;