@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<?php
2
3final class PhameBlogEditor
4 extends PhabricatorApplicationTransactionEditor {
5
6 public function getEditorApplicationClass() {
7 return PhabricatorPhameApplication::class;
8 }
9
10 public function getEditorObjectsDescription() {
11 return pht('Phame Blogs');
12 }
13
14 public function getCreateObjectTitle($author, $object) {
15 return pht('%s created this blog.', $author);
16 }
17
18 public function getCreateObjectTitleForFeed($author, $object) {
19 return pht('%s created %s.', $author, $object);
20 }
21
22 public function getTransactionTypes() {
23 $types = parent::getTransactionTypes();
24
25 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
26 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
27 $types[] = PhabricatorTransactions::TYPE_INTERACT_POLICY;
28
29 return $types;
30 }
31
32 protected function shouldSendMail(
33 PhabricatorLiskDAO $object,
34 array $xactions) {
35 return true;
36 }
37
38 protected function shouldPublishFeedStory(
39 PhabricatorLiskDAO $object,
40 array $xactions) {
41 return true;
42 }
43
44 protected function getMailTo(PhabricatorLiskDAO $object) {
45 $phids = array();
46 $phids[] = $this->requireActor()->getPHID();
47 $phids[] = $object->getCreatorPHID();
48
49 return $phids;
50 }
51
52 protected function buildMailTemplate(PhabricatorLiskDAO $object) {
53 $name = $object->getName();
54
55 return id(new PhabricatorMetaMTAMail())
56 ->setSubject($name);
57 }
58
59 protected function buildReplyHandler(PhabricatorLiskDAO $object) {
60 return id(new PhameBlogReplyHandler())
61 ->setMailReceiver($object);
62 }
63
64 protected function buildMailBody(
65 PhabricatorLiskDAO $object,
66 array $xactions) {
67
68 $body = parent::buildMailBody($object, $xactions);
69
70 $body->addLinkSection(
71 pht('BLOG DETAIL'),
72 PhabricatorEnv::getProductionURI($object->getViewURI()));
73
74 return $body;
75 }
76
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.'),
85 );
86 }
87
88 protected function getMailSubjectPrefix() {
89 return '[Phame]';
90 }
91
92
93 protected function supportsSearch() {
94 return true;
95 }
96
97 protected function shouldApplyHeraldRules(
98 PhabricatorLiskDAO $object,
99 array $xactions) {
100 return true;
101 }
102
103 protected function buildHeraldAdapter(
104 PhabricatorLiskDAO $object,
105 array $xactions) {
106
107 return id(new HeraldPhameBlogAdapter())
108 ->setBlog($object);
109 }
110
111}