@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 basic Herald support to Ponder

Summary: Ref T6919, Just a basic herald adapter (new questions) for Ponder

Test Plan: Created a Personal Rule, got subscribed to new question, saw transcript.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T6919

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

+81
+2
src/__phutil_library_map__.php
··· 1063 1063 'HeraldNotifyActionGroup' => 'applications/herald/action/HeraldNotifyActionGroup.php', 1064 1064 'HeraldObjectTranscript' => 'applications/herald/storage/transcript/HeraldObjectTranscript.php', 1065 1065 'HeraldPholioMockAdapter' => 'applications/pholio/herald/HeraldPholioMockAdapter.php', 1066 + 'HeraldPonderQuestionAdapter' => 'applications/ponder/herald/HeraldPonderQuestionAdapter.php', 1066 1067 'HeraldPreCommitAdapter' => 'applications/diffusion/herald/HeraldPreCommitAdapter.php', 1067 1068 'HeraldPreCommitContentAdapter' => 'applications/diffusion/herald/HeraldPreCommitContentAdapter.php', 1068 1069 'HeraldPreCommitRefAdapter' => 'applications/diffusion/herald/HeraldPreCommitRefAdapter.php', ··· 4789 4790 'HeraldNotifyActionGroup' => 'HeraldActionGroup', 4790 4791 'HeraldObjectTranscript' => 'Phobject', 4791 4792 'HeraldPholioMockAdapter' => 'HeraldAdapter', 4793 + 'HeraldPonderQuestionAdapter' => 'HeraldAdapter', 4792 4794 'HeraldPreCommitAdapter' => 'HeraldAdapter', 4793 4795 'HeraldPreCommitContentAdapter' => 'HeraldPreCommitAdapter', 4794 4796 'HeraldPreCommitRefAdapter' => 'HeraldPreCommitAdapter',
+3
src/applications/herald/controller/HeraldTestConsoleController.php
··· 45 45 } else if ($object instanceof PhrictionDocument) { 46 46 $adapter = id(new PhrictionDocumentHeraldAdapter()) 47 47 ->setDocument($object); 48 + } else if ($object instanceof PonderQuestion) { 49 + $adapter = id(new HeraldPonderQuestionAdapter()) 50 + ->setQuestion($object); 48 51 } else { 49 52 throw new Exception(pht('Can not build adapter for object!')); 50 53 }
+14
src/applications/ponder/editor/PonderQuestionEditor.php
··· 252 252 return $body; 253 253 } 254 254 255 + protected function shouldApplyHeraldRules( 256 + PhabricatorLiskDAO $object, 257 + array $xactions) { 258 + return true; 259 + } 260 + 261 + protected function buildHeraldAdapter( 262 + PhabricatorLiskDAO $object, 263 + array $xactions) { 264 + 265 + return id(new HeraldPonderQuestionAdapter()) 266 + ->setQuestion($object); 267 + } 268 + 255 269 }
+62
src/applications/ponder/herald/HeraldPonderQuestionAdapter.php
··· 1 + <?php 2 + 3 + final class HeraldPonderQuestionAdapter extends HeraldAdapter { 4 + 5 + private $question; 6 + 7 + protected function newObject() { 8 + return new PonderQuestion(); 9 + } 10 + 11 + public function getAdapterApplicationClass() { 12 + return 'PhabricatorPonderApplication'; 13 + } 14 + 15 + public function getAdapterContentDescription() { 16 + return pht('React to questions being created or updated.'); 17 + } 18 + 19 + protected function initializeNewAdapter() { 20 + $this->question = $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 setQuestion(PonderQuestion $question) { 46 + $this->question = $question; 47 + return $this; 48 + } 49 + 50 + public function getObject() { 51 + return $this->question; 52 + } 53 + 54 + public function getAdapterContentName() { 55 + return pht('Ponder Questions'); 56 + } 57 + 58 + public function getHeraldName() { 59 + return 'Q'.$this->getObject()->getID(); 60 + } 61 + 62 + }