@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 69 lines 1.6 kB view raw
1<?php 2 3final class PhrictionDocumentHeraldAdapter extends HeraldAdapter { 4 5 private $document; 6 7 public function getAdapterApplicationClass() { 8 return PhabricatorPhrictionApplication::class; 9 } 10 11 public function getAdapterContentDescription() { 12 return pht('React to wiki documents being created or updated.'); 13 } 14 15 protected function initializeNewAdapter() { 16 $this->document = $this->newObject(); 17 } 18 19 protected function newObject() { 20 return new PhrictionDocument(); 21 } 22 23 public function isTestAdapterForObject($object) { 24 return ($object instanceof PhrictionDocument); 25 } 26 27 public function getAdapterTestDescription() { 28 return pht( 29 'Test rules which run when a wiki document is created or updated.'); 30 } 31 32 public function setObject($object) { 33 $this->document = $object; 34 return $this; 35 } 36 37 public function getObject() { 38 return $this->document; 39 } 40 41 public function setDocument(PhrictionDocument $document) { 42 $this->document = $document; 43 return $this; 44 } 45 46 public function getDocument() { 47 return $this->document; 48 } 49 50 public function getAdapterContentName() { 51 return pht('Phriction Documents'); 52 } 53 54 public function supportsRuleType($rule_type) { 55 switch ($rule_type) { 56 case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: 57 case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: 58 return true; 59 case HeraldRuleTypeConfig::RULE_TYPE_OBJECT: 60 default: 61 return false; 62 } 63 } 64 65 public function getHeraldName() { 66 return pht('Wiki Document %d', $this->getDocument()->getID()); 67 } 68 69}