3 final class PhamePostEditor
4 extends PhabricatorApplicationTransactionEditor
{
6 public function getEditorApplicationClass() {
7 return 'PhabricatorPhameApplication';
10 public function getEditorObjectsDescription() {
11 return pht('Phame Posts');
14 public function getCreateObjectTitle($author, $object) {
15 return pht('%s created this post.', $author);
18 public function getCreateObjectTitleForFeed($author, $object) {
19 return pht('%s created %s.', $author, $object);
22 public function getTransactionTypes() {
23 $types = parent
::getTransactionTypes();
25 $types[] = PhabricatorTransactions
::TYPE_INTERACT_POLICY
;
26 $types[] = PhabricatorTransactions
::TYPE_COMMENT
;
31 protected function shouldSendMail(
32 PhabricatorLiskDAO
$object,
34 if ($object->isDraft() ||
($object->isArchived())) {
40 protected function shouldPublishFeedStory(
41 PhabricatorLiskDAO
$object,
43 if ($object->isDraft() ||
$object->isArchived()) {
49 protected function getMailTo(PhabricatorLiskDAO
$object) {
51 $phids[] = $object->getBloggerPHID();
52 $phids[] = $this->requireActor()->getPHID();
54 $blog_phid = $object->getBlogPHID();
56 $cc_phids = PhabricatorSubscribersQuery
::loadSubscribersForPHID(
58 foreach ($cc_phids as $cc) {
65 protected function buildMailTemplate(PhabricatorLiskDAO
$object) {
66 $title = $object->getTitle();
68 return id(new PhabricatorMetaMTAMail())
72 protected function buildReplyHandler(PhabricatorLiskDAO
$object) {
73 return id(new PhamePostReplyHandler())
74 ->setMailReceiver($object);
77 protected function buildMailBody(
78 PhabricatorLiskDAO
$object,
81 $body = parent
::buildMailBody($object, $xactions);
83 // We don't send mail if the object is a draft, and we only want
84 // to include the full body of the post on the either the
85 // first creation or if it was created as a draft, once it goes live.
86 if ($this->getIsNewObject()) {
87 $body->addRemarkupSection(null, $object->getBody());
89 foreach ($xactions as $xaction) {
90 switch ($xaction->getTransactionType()) {
91 case PhamePostVisibilityTransaction
::TRANSACTIONTYPE
:
92 if (!$object->isDraft() && !$object->isArchived()) {
93 $body->addRemarkupSection(null, $object->getBody());
100 $body->addLinkSection(
102 PhabricatorEnv
::getProductionURI($object->getViewURI()));
107 public function getMailTagsMap() {
109 PhamePostTransaction
::MAILTAG_CONTENT
=>
110 pht("A post's content changes."),
111 PhamePostTransaction
::MAILTAG_SUBSCRIBERS
=>
112 pht("A post's subscribers change."),
113 PhamePostTransaction
::MAILTAG_COMMENT
=>
114 pht('Someone comments on a post.'),
115 PhamePostTransaction
::MAILTAG_OTHER
=>
116 pht('Other post activity not listed above occurs.'),
120 protected function getMailSubjectPrefix() {
124 protected function supportsSearch() {
128 protected function shouldApplyHeraldRules(
129 PhabricatorLiskDAO
$object,
134 protected function buildHeraldAdapter(
135 PhabricatorLiskDAO
$object,
138 return id(new HeraldPhamePostAdapter())