@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 Ponder Question mail create receiver

Summary: Fixes T11115, but unclear how to test this. I think I've asked this in the past.

Test Plan:
- Visit Applications -> Ponder
- Configure external email
- Test External Email
- See new Question

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T11115

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

+67
+2
src/__phutil_library_map__.php
··· 4062 4062 'PonderModerateCapability' => 'applications/ponder/capability/PonderModerateCapability.php', 4063 4063 'PonderQuestion' => 'applications/ponder/storage/PonderQuestion.php', 4064 4064 'PonderQuestionCommentController' => 'applications/ponder/controller/PonderQuestionCommentController.php', 4065 + 'PonderQuestionCreateMailReceiver' => 'applications/ponder/mail/PonderQuestionCreateMailReceiver.php', 4065 4066 'PonderQuestionEditController' => 'applications/ponder/controller/PonderQuestionEditController.php', 4066 4067 'PonderQuestionEditor' => 'applications/ponder/editor/PonderQuestionEditor.php', 4067 4068 'PonderQuestionFulltextEngine' => 'applications/ponder/search/PonderQuestionFulltextEngine.php', ··· 9013 9014 'PhabricatorFulltextInterface', 9014 9015 ), 9015 9016 'PonderQuestionCommentController' => 'PonderController', 9017 + 'PonderQuestionCreateMailReceiver' => 'PhabricatorMailReceiver', 9016 9018 'PonderQuestionEditController' => 'PonderController', 9017 9019 'PonderQuestionEditor' => 'PonderEditor', 9018 9020 'PonderQuestionFulltextEngine' => 'PhabricatorFulltextEngine',
+15
src/applications/ponder/application/PhabricatorPonderApplication.php
··· 34 34 ); 35 35 } 36 36 37 + public function supportsEmailIntegration() { 38 + return true; 39 + } 40 + 41 + public function getAppEmailBlurb() { 42 + return pht( 43 + 'Send email to these addresses to create questions. %s', 44 + phutil_tag( 45 + 'a', 46 + array( 47 + 'href' => $this->getInboundEmailSupportLink(), 48 + ), 49 + pht('Learn More'))); 50 + } 51 + 37 52 public function getRoutes() { 38 53 return array( 39 54 '/Q(?P<id>[1-9]\d*)'
+49
src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php
··· 1 + <?php 2 + 3 + final class PonderQuestionCreateMailReceiver extends PhabricatorMailReceiver { 4 + 5 + public function isEnabled() { 6 + $app_class = 'PhabricatorPonderApplication'; 7 + return PhabricatorApplication::isClassInstalled($app_class); 8 + } 9 + 10 + public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) { 11 + $ponder_app = new PhabricatorPonderApplication(); 12 + return $this->canAcceptApplicationMail($ponder_app, $mail); 13 + } 14 + 15 + protected function processReceivedMail( 16 + PhabricatorMetaMTAReceivedMail $mail, 17 + PhabricatorUser $sender) { 18 + 19 + $title = $mail->getSubject(); 20 + if (!strlen($title)) { 21 + $title = pht('New Question'); 22 + } 23 + 24 + $xactions = array(); 25 + 26 + $xactions[] = id(new PonderQuestionTransaction()) 27 + ->setTransactionType(PonderQuestionTransaction::TYPE_TITLE) 28 + ->setNewValue($title); 29 + 30 + $xactions[] = id(new PonderQuestionTransaction()) 31 + ->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT) 32 + ->setNewValue($mail->getCleanTextBody()); 33 + 34 + $question = PonderQuestion::initializeNewQuestion($sender); 35 + 36 + $content_source = $mail->newContentSource(); 37 + 38 + $editor = id(new PonderQuestionEditor()) 39 + ->setActor($sender) 40 + ->setContentSource($content_source) 41 + ->setContinueOnNoEffect(true); 42 + $xactions = $editor->applyTransactions($question, $xactions); 43 + 44 + $mail->setRelatedPHID($question->getPHID()); 45 + 46 + } 47 + 48 + 49 + }
+1
src/applications/ponder/storage/PonderQuestion.php
··· 48 48 ->setViewPolicy($view_policy) 49 49 ->setStatus(PonderQuestionStatus::STATUS_OPEN) 50 50 ->setAnswerCount(0) 51 + ->setAnswerWiki('') 51 52 ->setSpacePHID($actor->getDefaultSpacePHID()); 52 53 } 53 54