Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14006845
D13828.id33392.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D13828.id33392.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1063,6 +1063,7 @@
'HeraldNotifyActionGroup' => 'applications/herald/action/HeraldNotifyActionGroup.php',
'HeraldObjectTranscript' => 'applications/herald/storage/transcript/HeraldObjectTranscript.php',
'HeraldPholioMockAdapter' => 'applications/pholio/herald/HeraldPholioMockAdapter.php',
+ 'HeraldPonderQuestionAdapter' => 'applications/ponder/herald/HeraldPonderQuestionAdapter.php',
'HeraldPreCommitAdapter' => 'applications/diffusion/herald/HeraldPreCommitAdapter.php',
'HeraldPreCommitContentAdapter' => 'applications/diffusion/herald/HeraldPreCommitContentAdapter.php',
'HeraldPreCommitRefAdapter' => 'applications/diffusion/herald/HeraldPreCommitRefAdapter.php',
@@ -4789,6 +4790,7 @@
'HeraldNotifyActionGroup' => 'HeraldActionGroup',
'HeraldObjectTranscript' => 'Phobject',
'HeraldPholioMockAdapter' => 'HeraldAdapter',
+ 'HeraldPonderQuestionAdapter' => 'HeraldAdapter',
'HeraldPreCommitAdapter' => 'HeraldAdapter',
'HeraldPreCommitContentAdapter' => 'HeraldPreCommitAdapter',
'HeraldPreCommitRefAdapter' => 'HeraldPreCommitAdapter',
diff --git a/src/applications/herald/controller/HeraldTestConsoleController.php b/src/applications/herald/controller/HeraldTestConsoleController.php
--- a/src/applications/herald/controller/HeraldTestConsoleController.php
+++ b/src/applications/herald/controller/HeraldTestConsoleController.php
@@ -45,6 +45,9 @@
} else if ($object instanceof PhrictionDocument) {
$adapter = id(new PhrictionDocumentHeraldAdapter())
->setDocument($object);
+ } else if ($object instanceof PonderQuestion) {
+ $adapter = id(new HeraldPonderQuestionAdapter())
+ ->setQuestion($object);
} else {
throw new Exception(pht('Can not build adapter for object!'));
}
diff --git a/src/applications/ponder/editor/PonderQuestionEditor.php b/src/applications/ponder/editor/PonderQuestionEditor.php
--- a/src/applications/ponder/editor/PonderQuestionEditor.php
+++ b/src/applications/ponder/editor/PonderQuestionEditor.php
@@ -252,4 +252,18 @@
return $body;
}
+ protected function shouldApplyHeraldRules(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ return true;
+ }
+
+ protected function buildHeraldAdapter(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+
+ return id(new HeraldPonderQuestionAdapter())
+ ->setQuestion($object);
+ }
+
}
diff --git a/src/applications/ponder/herald/HeraldPonderQuestionAdapter.php b/src/applications/ponder/herald/HeraldPonderQuestionAdapter.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/herald/HeraldPonderQuestionAdapter.php
@@ -0,0 +1,62 @@
+<?php
+
+final class HeraldPonderQuestionAdapter extends HeraldAdapter {
+
+ private $question;
+
+ protected function newObject() {
+ return new PonderQuestion();
+ }
+
+ public function getAdapterApplicationClass() {
+ return 'PhabricatorPonderApplication';
+ }
+
+ public function getAdapterContentDescription() {
+ return pht('React to questions being created or updated.');
+ }
+
+ protected function initializeNewAdapter() {
+ $this->question = $this->newObject();
+ }
+
+ public function supportsApplicationEmail() {
+ return true;
+ }
+
+ public function getRepetitionOptions() {
+ return array(
+ HeraldRepetitionPolicyConfig::EVERY,
+ HeraldRepetitionPolicyConfig::FIRST,
+ );
+ }
+
+ public function supportsRuleType($rule_type) {
+ switch ($rule_type) {
+ case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
+ case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
+ return true;
+ case HeraldRuleTypeConfig::RULE_TYPE_OBJECT:
+ default:
+ return false;
+ }
+ }
+
+ public function setQuestion(PonderQuestion $question) {
+ $this->question = $question;
+ return $this;
+ }
+
+ public function getObject() {
+ return $this->question;
+ }
+
+ public function getAdapterContentName() {
+ return pht('Ponder Questions');
+ }
+
+ public function getHeraldName() {
+ return 'Q'.$this->getObject()->getID();
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 29, 6:54 PM (3 w, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6705819
Default Alt Text
D13828.id33392.diff (4 KB)
Attached To
Mode
D13828: Add basic Herald support to Ponder
Attached
Detach File
Event Timeline
Log In to Comment