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

Add Herald Adapters to Phame

Summary: Adds a basic HeraldAdapter to Phame Blogs and Posts.

Test Plan: Make a Herald rule to CC me on new posts or blogs automatically.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14897

+156
+4
src/__phutil_library_map__.php
··· 1155 1155 'HeraldNewObjectField' => 'applications/herald/field/HeraldNewObjectField.php', 1156 1156 'HeraldNotifyActionGroup' => 'applications/herald/action/HeraldNotifyActionGroup.php', 1157 1157 'HeraldObjectTranscript' => 'applications/herald/storage/transcript/HeraldObjectTranscript.php', 1158 + 'HeraldPhameBlogAdapter' => 'applications/phame/herald/HeraldPhameBlogAdapter.php', 1159 + 'HeraldPhamePostAdapter' => 'applications/phame/herald/HeraldPhamePostAdapter.php', 1158 1160 'HeraldPholioMockAdapter' => 'applications/pholio/herald/HeraldPholioMockAdapter.php', 1159 1161 'HeraldPonderQuestionAdapter' => 'applications/ponder/herald/HeraldPonderQuestionAdapter.php', 1160 1162 'HeraldPreCommitAdapter' => 'applications/diffusion/herald/HeraldPreCommitAdapter.php', ··· 5213 5215 'HeraldNewObjectField' => 'HeraldField', 5214 5216 'HeraldNotifyActionGroup' => 'HeraldActionGroup', 5215 5217 'HeraldObjectTranscript' => 'Phobject', 5218 + 'HeraldPhameBlogAdapter' => 'HeraldAdapter', 5219 + 'HeraldPhamePostAdapter' => 'HeraldAdapter', 5216 5220 'HeraldPholioMockAdapter' => 'HeraldAdapter', 5217 5221 'HeraldPonderQuestionAdapter' => 'HeraldAdapter', 5218 5222 'HeraldPreCommitAdapter' => 'HeraldAdapter',
+14
src/applications/phame/editor/PhameBlogEditor.php
··· 230 230 return false; 231 231 } 232 232 233 + protected function shouldApplyHeraldRules( 234 + PhabricatorLiskDAO $object, 235 + array $xactions) { 236 + return true; 237 + } 238 + 239 + protected function buildHeraldAdapter( 240 + PhabricatorLiskDAO $object, 241 + array $xactions) { 242 + 243 + return id(new HeraldPhameBlogAdapter()) 244 + ->setBlog($object); 245 + } 246 + 233 247 }
+14
src/applications/phame/editor/PhamePostEditor.php
··· 264 264 return false; 265 265 } 266 266 267 + protected function shouldApplyHeraldRules( 268 + PhabricatorLiskDAO $object, 269 + array $xactions) { 270 + return true; 271 + } 272 + 273 + protected function buildHeraldAdapter( 274 + PhabricatorLiskDAO $object, 275 + array $xactions) { 276 + 277 + return id(new HeraldPhamePostAdapter()) 278 + ->setPost($object); 279 + } 280 + 267 281 }
+62
src/applications/phame/herald/HeraldPhameBlogAdapter.php
··· 1 + <?php 2 + 3 + final class HeraldPhameBlogAdapter extends HeraldAdapter { 4 + 5 + private $blog; 6 + 7 + protected function newObject() { 8 + return new PhameBlog(); 9 + } 10 + 11 + public function getAdapterApplicationClass() { 12 + return 'PhabricatorPhameApplication'; 13 + } 14 + 15 + public function getAdapterContentDescription() { 16 + return pht('React to Phame Blogs being created or updated.'); 17 + } 18 + 19 + protected function initializeNewAdapter() { 20 + $this->blog = $this->newObject(); 21 + } 22 + 23 + public function supportsApplicationEmail() { 24 + return true; 25 + } 26 + 27 + public function getRepetitionOptions() { 28 + return array( 29 + HeraldRepetitionPolicyConfig::EVERY, 30 + HeraldRepetitionPolicyConfig::FIRST, 31 + ); 32 + } 33 + 34 + public function supportsRuleType($rule_type) { 35 + switch ($rule_type) { 36 + case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: 37 + case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: 38 + return true; 39 + case HeraldRuleTypeConfig::RULE_TYPE_OBJECT: 40 + default: 41 + return false; 42 + } 43 + } 44 + 45 + public function setBlog(PhameBlog $blog) { 46 + $this->blog = $blog; 47 + return $this; 48 + } 49 + 50 + public function getObject() { 51 + return $this->blog; 52 + } 53 + 54 + public function getAdapterContentName() { 55 + return pht('Phame Blogs'); 56 + } 57 + 58 + public function getHeraldName() { 59 + return 'BLOG'.$this->getObject()->getID(); 60 + } 61 + 62 + }
+62
src/applications/phame/herald/HeraldPhamePostAdapter.php
··· 1 + <?php 2 + 3 + final class HeraldPhamePostAdapter extends HeraldAdapter { 4 + 5 + private $post; 6 + 7 + protected function newObject() { 8 + return new PhamePost(); 9 + } 10 + 11 + public function getAdapterApplicationClass() { 12 + return 'PhabricatorPhameApplication'; 13 + } 14 + 15 + public function getAdapterContentDescription() { 16 + return pht('React to Phame Posts being created or updated.'); 17 + } 18 + 19 + protected function initializeNewAdapter() { 20 + $this->post = $this->newObject(); 21 + } 22 + 23 + public function supportsApplicationEmail() { 24 + return true; 25 + } 26 + 27 + public function getRepetitionOptions() { 28 + return array( 29 + HeraldRepetitionPolicyConfig::EVERY, 30 + HeraldRepetitionPolicyConfig::FIRST, 31 + ); 32 + } 33 + 34 + public function supportsRuleType($rule_type) { 35 + switch ($rule_type) { 36 + case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: 37 + case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: 38 + return true; 39 + case HeraldRuleTypeConfig::RULE_TYPE_OBJECT: 40 + default: 41 + return false; 42 + } 43 + } 44 + 45 + public function setPost(PhamePost $post) { 46 + $this->post = $post; 47 + return $this; 48 + } 49 + 50 + public function getObject() { 51 + return $this->post; 52 + } 53 + 54 + public function getAdapterContentName() { 55 + return pht('Phame Posts'); 56 + } 57 + 58 + public function getHeraldName() { 59 + return 'POST'.$this->getObject()->getID(); 60 + } 61 + 62 + }