@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 68 lines 1.8 kB view raw
1<?php 2 3abstract class ManiphestTaskRelationship 4 extends PhabricatorObjectRelationship { 5 6 public function isEnabledForObject($object) { 7 $viewer = $this->getViewer(); 8 9 $has_app = PhabricatorApplication::isClassInstalledForViewer( 10 PhabricatorManiphestApplication::class, 11 $viewer); 12 if (!$has_app) { 13 return false; 14 } 15 16 return ($object instanceof ManiphestTask); 17 } 18 19 protected function newMergeIntoTransactions(ManiphestTask $task) { 20 return array( 21 id(new ManiphestTransaction()) 22 ->setTransactionType( 23 ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE) 24 ->setNewValue($task->getPHID()), 25 ); 26 } 27 28 protected function newMergeFromTransactions(array $tasks) { 29 $xactions = array(); 30 31 $subscriber_phids = $this->loadMergeSubscriberPHIDs($tasks); 32 33 $xactions[] = id(new ManiphestTransaction()) 34 ->setTransactionType(ManiphestTaskMergedFromTransaction::TRANSACTIONTYPE) 35 ->setNewValue(mpull($tasks, 'getPHID')); 36 37 $xactions[] = id(new ManiphestTransaction()) 38 ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) 39 ->setNewValue(array('+' => $subscriber_phids)); 40 41 return $xactions; 42 } 43 44 private function loadMergeSubscriberPHIDs(array $tasks) { 45 $phids = array(); 46 47 foreach ($tasks as $task) { 48 $phids[] = $task->getAuthorPHID(); 49 $phids[] = $task->getOwnerPHID(); 50 } 51 52 $subscribers = id(new PhabricatorSubscribersQuery()) 53 ->withObjectPHIDs(mpull($tasks, 'getPHID')) 54 ->execute(); 55 56 foreach ($subscribers as $phid => $subscriber_list) { 57 foreach ($subscriber_list as $subscriber) { 58 $phids[] = $subscriber; 59 } 60 } 61 62 $phids = array_unique($phids); 63 $phids = array_filter($phids); 64 65 return $phids; 66 } 67 68}