@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 PhabricatorFileEditor
4 extends PhabricatorApplicationTransactionEditor {
5
6 public function getEditorApplicationClass() {
7 return PhabricatorFilesApplication::class;
8 }
9
10 public function getEditorObjectsDescription() {
11 return pht('Files');
12 }
13
14 public function getTransactionTypes() {
15 $types = parent::getTransactionTypes();
16
17 $types[] = PhabricatorTransactions::TYPE_COMMENT;
18 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
19
20 return $types;
21 }
22
23 protected function shouldSendMail(
24 PhabricatorLiskDAO $object,
25 array $xactions) {
26 return true;
27 }
28
29 protected function getMailSubjectPrefix() {
30 return pht('[File]');
31 }
32
33 protected function getMailTo(PhabricatorLiskDAO $object) {
34 return array(
35 $object->getAuthorPHID(),
36 $this->requireActor()->getPHID(),
37 );
38 }
39
40 protected function buildReplyHandler(PhabricatorLiskDAO $object) {
41 return id(new FileReplyHandler())
42 ->setMailReceiver($object);
43 }
44
45 protected function buildMailTemplate(PhabricatorLiskDAO $object) {
46 $id = $object->getID();
47 $name = $object->getName();
48
49 return id(new PhabricatorMetaMTAMail())
50 ->setSubject("F{$id}: {$name}");
51 }
52
53 protected function buildMailBody(
54 PhabricatorLiskDAO $object,
55 array $xactions) {
56
57 $body = parent::buildMailBody($object, $xactions);
58
59 $body->addTextSection(
60 pht('FILE DETAIL'),
61 PhabricatorEnv::getProductionURI($object->getInfoURI()));
62
63 return $body;
64 }
65
66 protected function shouldPublishFeedStory(
67 PhabricatorLiskDAO $object,
68 array $xactions) {
69 return true;
70 }
71
72 protected function supportsSearch() {
73 return true;
74 }
75
76}