Give Phame blogs mutable interact policies
[phabricator.git] / src / applications / phame / editor / PhameBlogEditor.php
blob656ede95fe60169ef864c26bfb15977789633592
1 <?php
3 final class PhameBlogEditor
4 extends PhabricatorApplicationTransactionEditor {
6 public function getEditorApplicationClass() {
7 return 'PhabricatorPhameApplication';
10 public function getEditorObjectsDescription() {
11 return pht('Phame Blogs');
14 public function getCreateObjectTitle($author, $object) {
15 return pht('%s created this blog.', $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_VIEW_POLICY;
26 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
27 $types[] = PhabricatorTransactions::TYPE_INTERACT_POLICY;
29 return $types;
32 protected function shouldSendMail(
33 PhabricatorLiskDAO $object,
34 array $xactions) {
35 return true;
38 protected function shouldPublishFeedStory(
39 PhabricatorLiskDAO $object,
40 array $xactions) {
41 return true;
44 protected function getMailTo(PhabricatorLiskDAO $object) {
45 $phids = array();
46 $phids[] = $this->requireActor()->getPHID();
47 $phids[] = $object->getCreatorPHID();
49 return $phids;
52 protected function buildMailTemplate(PhabricatorLiskDAO $object) {
53 $name = $object->getName();
55 return id(new PhabricatorMetaMTAMail())
56 ->setSubject($name);
59 protected function buildReplyHandler(PhabricatorLiskDAO $object) {
60 return id(new PhameBlogReplyHandler())
61 ->setMailReceiver($object);
64 protected function buildMailBody(
65 PhabricatorLiskDAO $object,
66 array $xactions) {
68 $body = parent::buildMailBody($object, $xactions);
70 $body->addLinkSection(
71 pht('BLOG DETAIL'),
72 PhabricatorEnv::getProductionURI($object->getViewURI()));
74 return $body;
77 public function getMailTagsMap() {
78 return array(
79 PhameBlogTransaction::MAILTAG_DETAILS =>
80 pht("A blog's details change."),
81 PhameBlogTransaction::MAILTAG_SUBSCRIBERS =>
82 pht("A blog's subscribers change."),
83 PhameBlogTransaction::MAILTAG_OTHER =>
84 pht('Other blog activity not listed above occurs.'),
88 protected function getMailSubjectPrefix() {
89 return '[Phame]';
93 protected function supportsSearch() {
94 return true;
97 protected function shouldApplyHeraldRules(
98 PhabricatorLiskDAO $object,
99 array $xactions) {
100 return true;
103 protected function buildHeraldAdapter(
104 PhabricatorLiskDAO $object,
105 array $xactions) {
107 return id(new HeraldPhameBlogAdapter())
108 ->setBlog($object);