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