@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 upstream/main 100 lines 2.3 kB view raw
1<?php 2 3abstract class PhabricatorTimelineEngine 4 extends Phobject { 5 6 private $viewer; 7 private $object; 8 private $xactions; 9 private $request; 10 private $viewData; 11 12 final public static function newForObject($object) { 13 if ($object instanceof PhabricatorTimelineInterface) { 14 $engine = $object->newTimelineEngine(); 15 } else { 16 $engine = new PhabricatorStandardTimelineEngine(); 17 } 18 19 $engine->setObject($object); 20 21 return $engine; 22 } 23 24 final public function setViewer(PhabricatorUser $viewer) { 25 $this->viewer = $viewer; 26 return $this; 27 } 28 29 final public function getViewer() { 30 return $this->viewer; 31 } 32 33 final public function setObject($object) { 34 $this->object = $object; 35 return $this; 36 } 37 38 final public function getObject() { 39 return $this->object; 40 } 41 42 /** 43 * @param array<PhabricatorApplicationTransaction> $xactions 44 */ 45 final public function setTransactions(array $xactions) { 46 assert_instances_of($xactions, PhabricatorApplicationTransaction::class); 47 $this->xactions = $xactions; 48 return $this; 49 } 50 51 final public function getTransactions() { 52 return $this->xactions; 53 } 54 55 final public function setRequest(AphrontRequest $request) { 56 $this->request = $request; 57 return $this; 58 } 59 60 final public function getRequest() { 61 return $this->request; 62 } 63 64 final public function setViewData(array $view_data) { 65 $this->viewData = $view_data; 66 return $this; 67 } 68 69 final public function getViewData() { 70 return $this->viewData; 71 } 72 73 final public function buildTimelineView() { 74 $view = $this->newTimelineView(); 75 76 if (!($view instanceof PhabricatorApplicationTransactionView)) { 77 throw new Exception( 78 pht( 79 'Expected "newTimelineView()" to return an object of class "%s" '. 80 '(in engine "%s").', 81 'PhabricatorApplicationTransactionView', 82 get_class($this))); 83 } 84 85 $viewer = $this->getViewer(); 86 $object = $this->getObject(); 87 $xactions = $this->getTransactions(); 88 89 return $view 90 ->setViewer($viewer) 91 ->setObject($object) 92 ->setObjectPHID($object->getPHID()) 93 ->setTransactions($xactions); 94 } 95 96 protected function newTimelineView() { 97 return new PhabricatorApplicationTransactionView(); 98 } 99 100}