3 final class PhabricatorEditorMailEngineExtension
4 extends PhabricatorMailEngineExtension
{
6 const EXTENSIONKEY
= 'editor';
8 public function supportsObject($object) {
12 public function newMailStampTemplates($object) {
15 $templates[] = id(new PhabricatorPHIDMailStamp())
17 ->setLabel(pht('Acting User'));
19 $templates[] = id(new PhabricatorStringMailStamp())
21 ->setLabel(pht('Via Content Source'));
23 $templates[] = id(new PhabricatorBoolMailStamp())
25 ->setLabel(pht('Silent Edit'));
27 $templates[] = id(new PhabricatorBoolMailStamp())
29 ->setLabel(pht('Encryption Required'));
31 $templates[] = id(new PhabricatorBoolMailStamp())
33 ->setLabel(pht('New Object'));
35 $templates[] = id(new PhabricatorPHIDMailStamp())
37 ->setLabel(pht('Mentioned User'));
39 $templates[] = id(new PhabricatorStringMailStamp())
41 ->setLabel(pht('Herald Rule'));
43 $templates[] = id(new PhabricatorPHIDMailStamp())
45 ->setLabel(pht('Recipient Removed'));
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());