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();
24 $types[] = PhabricatorTransactions
::TYPE_COMMENT
;
29 protected function shouldSendMail(
30 PhabricatorLiskDAO
$object,
32 if ($object->isDraft() ||
($object->isArchived())) {
38 protected function shouldPublishFeedStory(
39 PhabricatorLiskDAO
$object,
41 if ($object->isDraft() ||
$object->isArchived()) {
47 protected function getMailTo(PhabricatorLiskDAO
$object) {
49 $phids[] = $object->getBloggerPHID();
50 $phids[] = $this->requireActor()->getPHID();
52 $blog_phid = $object->getBlogPHID();
54 $cc_phids = PhabricatorSubscribersQuery
::loadSubscribersForPHID(
56 foreach ($cc_phids as $cc) {
63 protected function buildMailTemplate(PhabricatorLiskDAO
$object) {
64 $title = $object->getTitle();
66 return id(new PhabricatorMetaMTAMail())
70 protected function buildReplyHandler(PhabricatorLiskDAO
$object) {
71 return id(new PhamePostReplyHandler())
72 ->setMailReceiver($object);
75 protected function buildMailBody(
76 PhabricatorLiskDAO
$object,
79 $body = parent
::buildMailBody($object, $xactions);
81 // We don't send mail if the object is a draft, and we only want
82 // to include the full body of the post on the either the
83 // first creation or if it was created as a draft, once it goes live.
84 if ($this->getIsNewObject()) {
85 $body->addRemarkupSection(null, $object->getBody());
87 foreach ($xactions as $xaction) {
88 switch ($xaction->getTransactionType()) {
89 case PhamePostVisibilityTransaction
::TRANSACTIONTYPE
:
90 if (!$object->isDraft() && !$object->isArchived()) {
91 $body->addRemarkupSection(null, $object->getBody());
98 $body->addLinkSection(
100 PhabricatorEnv
::getProductionURI($object->getViewURI()));
105 public function getMailTagsMap() {
107 PhamePostTransaction
::MAILTAG_CONTENT
=>
108 pht("A post's content changes."),
109 PhamePostTransaction
::MAILTAG_SUBSCRIBERS
=>
110 pht("A post's subscribers change."),
111 PhamePostTransaction
::MAILTAG_COMMENT
=>
112 pht('Someone comments on a post.'),
113 PhamePostTransaction
::MAILTAG_OTHER
=>
114 pht('Other post activity not listed above occurs.'),
118 protected function getMailSubjectPrefix() {
122 protected function supportsSearch() {
126 protected function shouldApplyHeraldRules(
127 PhabricatorLiskDAO
$object,
132 protected function buildHeraldAdapter(
133 PhabricatorLiskDAO
$object,
136 return id(new HeraldPhamePostAdapter())