@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 PhabricatorSubscriptionsFulltextEngineExtension
4 extends PhabricatorFulltextEngineExtension {
5
6 const EXTENSIONKEY = 'subscriptions';
7
8 public function getExtensionName() {
9 return pht('Subscribers');
10 }
11
12 public function shouldEnrichFulltextObject($object) {
13 return ($object instanceof PhabricatorSubscribableInterface);
14 }
15
16 public function enrichFulltextObject(
17 $object,
18 PhabricatorSearchAbstractDocument $document) {
19
20 $subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
21 $object->getPHID());
22
23 if (!$subscriber_phids) {
24 return;
25 }
26
27 $handles = id(new PhabricatorHandleQuery())
28 ->setViewer($this->getViewer())
29 ->withPHIDs($subscriber_phids)
30 ->execute();
31
32 foreach ($handles as $phid => $handle) {
33 $document->addRelationship(
34 PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER,
35 $phid,
36 $handle->getType(),
37 $document->getDocumentModified()); // Bogus timestamp.
38 }
39 }
40
41}