Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14407356
D16084.id38700.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
D16084.id38700.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
@@ -4062,6 +4062,7 @@
'PonderModerateCapability' => 'applications/ponder/capability/PonderModerateCapability.php',
'PonderQuestion' => 'applications/ponder/storage/PonderQuestion.php',
'PonderQuestionCommentController' => 'applications/ponder/controller/PonderQuestionCommentController.php',
+ 'PonderQuestionCreateMailReceiver' => 'applications/ponder/mail/PonderQuestionCreateMailReceiver.php',
'PonderQuestionEditController' => 'applications/ponder/controller/PonderQuestionEditController.php',
'PonderQuestionEditor' => 'applications/ponder/editor/PonderQuestionEditor.php',
'PonderQuestionFulltextEngine' => 'applications/ponder/search/PonderQuestionFulltextEngine.php',
@@ -9013,6 +9014,7 @@
'PhabricatorFulltextInterface',
),
'PonderQuestionCommentController' => 'PonderController',
+ 'PonderQuestionCreateMailReceiver' => 'PhabricatorMailReceiver',
'PonderQuestionEditController' => 'PonderController',
'PonderQuestionEditor' => 'PonderEditor',
'PonderQuestionFulltextEngine' => 'PhabricatorFulltextEngine',
diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php
--- a/src/applications/ponder/application/PhabricatorPonderApplication.php
+++ b/src/applications/ponder/application/PhabricatorPonderApplication.php
@@ -34,6 +34,21 @@
);
}
+ public function supportsEmailIntegration() {
+ return true;
+ }
+
+ public function getAppEmailBlurb() {
+ return pht(
+ 'Send email to these addresses to create questions. %s',
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => $this->getInboundEmailSupportLink(),
+ ),
+ pht('Learn More')));
+ }
+
public function getRoutes() {
return array(
'/Q(?P<id>[1-9]\d*)'
diff --git a/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php b/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php
@@ -0,0 +1,49 @@
+<?php
+
+final class PonderQuestionCreateMailReceiver extends PhabricatorMailReceiver {
+
+ public function isEnabled() {
+ $app_class = 'PhabricatorPonderApplication';
+ return PhabricatorApplication::isClassInstalled($app_class);
+ }
+
+ public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) {
+ $ponder_app = new PhabricatorPonderApplication();
+ return $this->canAcceptApplicationMail($ponder_app, $mail);
+ }
+
+ protected function processReceivedMail(
+ PhabricatorMetaMTAReceivedMail $mail,
+ PhabricatorUser $sender) {
+
+ $title = $mail->getSubject();
+ if (!strlen($title)) {
+ $title = pht('New Question');
+ }
+
+ $xactions = array();
+
+ $xactions[] = id(new PonderQuestionTransaction())
+ ->setTransactionType(PonderQuestionTransaction::TYPE_TITLE)
+ ->setNewValue($title);
+
+ $xactions[] = id(new PonderQuestionTransaction())
+ ->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT)
+ ->setNewValue($mail->getCleanTextBody());
+
+ $question = PonderQuestion::initializeNewQuestion($sender);
+
+ $content_source = $mail->newContentSource();
+
+ $editor = id(new PonderQuestionEditor())
+ ->setActor($sender)
+ ->setContentSource($content_source)
+ ->setContinueOnNoEffect(true);
+ $xactions = $editor->applyTransactions($question, $xactions);
+
+ $mail->setRelatedPHID($question->getPHID());
+
+ }
+
+
+}
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -48,6 +48,7 @@
->setViewPolicy($view_policy)
->setStatus(PonderQuestionStatus::STATUS_OPEN)
->setAnswerCount(0)
+ ->setAnswerWiki('')
->setSpacePHID($actor->getDefaultSpacePHID());
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 2:47 AM (4 h, 42 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6924494
Default Alt Text
D16084.id38700.diff (4 KB)
Attached To
Mode
D16084: Add Ponder Question mail create receiver
Attached
Detach File
Event Timeline
Log In to Comment