@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 85 lines 2.1 kB view raw
1<?php 2 3final class PonderAnswerEditor extends PonderEditor { 4 5 public function getEditorObjectsDescription() { 6 return pht('Ponder Answers'); 7 } 8 9 public function getCreateObjectTitle($author, $object) { 10 return pht('%s added this answer.', $author); 11 } 12 13 public function getCreateObjectTitleForFeed($author, $object) { 14 return pht('%s added %s.', $author, $object); 15 } 16 17 public function getTransactionTypes() { 18 $types = parent::getTransactionTypes(); 19 $types[] = PhabricatorTransactions::TYPE_COMMENT; 20 21 return $types; 22 } 23 24 protected function shouldSendMail( 25 PhabricatorLiskDAO $object, 26 array $xactions) { 27 return true; 28 } 29 30 protected function getMailTo(PhabricatorLiskDAO $object) { 31 $phids = array(); 32 $phids[] = $object->getAuthorPHID(); 33 $phids[] = $this->requireActor()->getPHID(); 34 35 $question = id(new PonderQuestionQuery()) 36 ->setViewer($this->requireActor()) 37 ->withIDs(array($object->getQuestionID())) 38 ->executeOne(); 39 40 $phids[] = $question->getAuthorPHID(); 41 42 return $phids; 43 } 44 45 protected function shouldPublishFeedStory( 46 PhabricatorLiskDAO $object, 47 array $xactions) { 48 return true; 49 } 50 51 protected function buildReplyHandler(PhabricatorLiskDAO $object) { 52 return id(new PonderAnswerReplyHandler()) 53 ->setMailReceiver($object); 54 } 55 56 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 57 $id = $object->getID(); 58 59 return id(new PhabricatorMetaMTAMail()) 60 ->setSubject("ANSR{$id}"); 61 } 62 63 protected function buildMailBody( 64 PhabricatorLiskDAO $object, 65 array $xactions) { 66 67 $body = parent::buildMailBody($object, $xactions); 68 69 // If the user just gave the answer, add the answer text. 70 foreach ($xactions as $xaction) { 71 $type = $xaction->getTransactionType(); 72 $new = $xaction->getNewValue(); 73 if ($type == PonderAnswerContentTransaction::TRANSACTIONTYPE) { 74 $body->addRawSection($new); 75 } 76 } 77 78 $body->addLinkSection( 79 pht('ANSWER DETAIL'), 80 PhabricatorEnv::getProductionURI($object->getURI())); 81 82 return $body; 83 } 84 85}