Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / transactions / engineextension / PhabricatorEditorMailEngineExtension.php
blob5365894429ee52acfc387e3a8a5135b125dd5343
1 <?php
3 final class PhabricatorEditorMailEngineExtension
4 extends PhabricatorMailEngineExtension {
6 const EXTENSIONKEY = 'editor';
8 public function supportsObject($object) {
9 return true;
12 public function newMailStampTemplates($object) {
13 $templates = array();
15 $templates[] = id(new PhabricatorPHIDMailStamp())
16 ->setKey('actor')
17 ->setLabel(pht('Acting User'));
19 $templates[] = id(new PhabricatorStringMailStamp())
20 ->setKey('via')
21 ->setLabel(pht('Via Content Source'));
23 $templates[] = id(new PhabricatorBoolMailStamp())
24 ->setKey('silent')
25 ->setLabel(pht('Silent Edit'));
27 $templates[] = id(new PhabricatorBoolMailStamp())
28 ->setKey('encrypted')
29 ->setLabel(pht('Encryption Required'));
31 $templates[] = id(new PhabricatorBoolMailStamp())
32 ->setKey('new')
33 ->setLabel(pht('New Object'));
35 $templates[] = id(new PhabricatorPHIDMailStamp())
36 ->setKey('mention')
37 ->setLabel(pht('Mentioned User'));
39 $templates[] = id(new PhabricatorStringMailStamp())
40 ->setKey('herald')
41 ->setLabel(pht('Herald Rule'));
43 $templates[] = id(new PhabricatorPHIDMailStamp())
44 ->setKey('removed')
45 ->setLabel(pht('Recipient Removed'));
47 return $templates;
50 public function newMailStamps($object, array $xactions) {
51 $editor = $this->getEditor();
52 $viewer = $this->getViewer();
54 $this->getMailStamp('actor')
55 ->setValue($editor->getActingAsPHID());
57 $content_source = $editor->getContentSource();
58 $this->getMailStamp('via')
59 ->setValue($content_source->getSourceTypeConstant());
61 $this->getMailStamp('silent')
62 ->setValue($editor->getIsSilent());
64 $this->getMailStamp('encrypted')
65 ->setValue($editor->getMustEncrypt());
67 $this->getMailStamp('new')
68 ->setValue($editor->getIsNewObject());
70 $mentioned_phids = $editor->getMentionedPHIDs();
71 $this->getMailStamp('mention')
72 ->setValue($mentioned_phids);
74 $this->getMailStamp('herald')
75 ->setValue($editor->getHeraldRuleMonograms());
77 $this->getMailStamp('removed')
78 ->setValue($editor->getRemovedRecipientPHIDs());