Path: blob/master/src/applications/paste/editor/PhabricatorPasteEditor.php
12241 views
<?php12final class PhabricatorPasteEditor3extends PhabricatorApplicationTransactionEditor {45private $newPasteTitle;67public function getNewPasteTitle() {8return $this->newPasteTitle;9}1011public function getEditorApplicationClass() {12return 'PhabricatorPasteApplication';13}1415public function getEditorObjectsDescription() {16return pht('Pastes');17}1819public function getCreateObjectTitle($author, $object) {20return pht('%s created this paste.', $author);21}2223public function getCreateObjectTitleForFeed($author, $object) {24return pht('%s created %s.', $author, $object);25}2627public function getTransactionTypes() {28$types = parent::getTransactionTypes();2930$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;31$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;32$types[] = PhabricatorTransactions::TYPE_COMMENT;3334return $types;35}3637protected function expandTransactions(38PhabricatorLiskDAO $object,39array $xactions) {4041$new_title = $object->getTitle();42foreach ($xactions as $xaction) {43$type = $xaction->getTransactionType();44if ($type === PhabricatorPasteTitleTransaction::TRANSACTIONTYPE) {45$new_title = $xaction->getNewValue();46}47}48$this->newPasteTitle = $new_title;4950return parent::expandTransactions($object, $xactions);51}5253protected function shouldSendMail(54PhabricatorLiskDAO $object,55array $xactions) {5657if ($this->getIsNewObject()) {58return false;59}6061return true;62}6364protected function getMailSubjectPrefix() {65return pht('[Paste]');66}6768protected function getMailTo(PhabricatorLiskDAO $object) {69return array(70$object->getAuthorPHID(),71$this->getActingAsPHID(),72);73}7475public function getMailTagsMap() {76return array(77PhabricatorPasteTransaction::MAILTAG_CONTENT =>78pht('Paste title, language or text changes.'),79PhabricatorPasteTransaction::MAILTAG_COMMENT =>80pht('Someone comments on a paste.'),81PhabricatorPasteTransaction::MAILTAG_OTHER =>82pht('Other paste activity not listed above occurs.'),83);84}8586protected function buildReplyHandler(PhabricatorLiskDAO $object) {87return id(new PasteReplyHandler())88->setMailReceiver($object);89}9091protected function buildMailTemplate(PhabricatorLiskDAO $object) {92$id = $object->getID();93$name = $object->getTitle();9495return id(new PhabricatorMetaMTAMail())96->setSubject("P{$id}: {$name}");97}9899protected function buildMailBody(100PhabricatorLiskDAO $object,101array $xactions) {102103$body = parent::buildMailBody($object, $xactions);104105$body->addLinkSection(106pht('PASTE DETAIL'),107PhabricatorEnv::getProductionURI('/P'.$object->getID()));108109return $body;110}111112protected function shouldPublishFeedStory(113PhabricatorLiskDAO $object,114array $xactions) {115return true;116}117118protected function supportsSearch() {119return true;120}121122}123124125