@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 64 lines 2.2 kB view raw
1<?php 2 3final class DifferentialRevisionFulltextEngine 4 extends PhabricatorFulltextEngine { 5 6 protected function buildAbstractDocument( 7 PhabricatorSearchAbstractDocument $document, 8 $object) { 9 10 $revision = id(new DifferentialRevisionQuery()) 11 ->setViewer($this->getViewer()) 12 ->withPHIDs(array($object->getPHID())) 13 ->needReviewers(true) 14 ->executeOne(); 15 16 // TODO: This isn't very clean, but custom fields currently rely on it. 17 $object->attachReviewers($revision->getReviewers()); 18 19 $document->setDocumentTitle($revision->getTitle()); 20 21 $document->addRelationship( 22 PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, 23 $revision->getAuthorPHID(), 24 PhabricatorPeopleUserPHIDType::TYPECONST, 25 $revision->getDateCreated()); 26 27 $document->addRelationship( 28 $revision->isClosed() 29 ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED 30 : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 31 $revision->getPHID(), 32 DifferentialRevisionPHIDType::TYPECONST, 33 PhabricatorTime::getNow()); 34 35 // If a revision needs review, the owners are the reviewers. Otherwise, the 36 // owner is the author (e.g., accepted, rejected, closed). 37 if ($revision->isNeedsReview()) { 38 $reviewers = $revision->getReviewerPHIDs(); 39 $reviewers = array_fuse($reviewers); 40 41 if ($reviewers) { 42 foreach ($reviewers as $phid) { 43 $document->addRelationship( 44 PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 45 $phid, 46 PhabricatorPeopleUserPHIDType::TYPECONST, 47 $revision->getDateModified()); // Bogus timestamp. 48 } 49 } else { 50 $document->addRelationship( 51 PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, 52 $revision->getPHID(), 53 PhabricatorPeopleUserPHIDType::TYPECONST, 54 $revision->getDateModified()); // Bogus timestamp. 55 } 56 } else { 57 $document->addRelationship( 58 PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 59 $revision->getAuthorPHID(), 60 PhabricatorPHIDConstants::PHID_TYPE_VOID, 61 $revision->getDateCreated()); 62 } 63 } 64}