Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15449978
D13905.id33562.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D13905.id33562.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
@@ -3392,8 +3392,10 @@
'PonderAnswerEditor' => 'applications/ponder/editor/PonderAnswerEditor.php',
'PonderAnswerHasVotingUserEdgeType' => 'applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php',
'PonderAnswerHistoryController' => 'applications/ponder/controller/PonderAnswerHistoryController.php',
+ 'PonderAnswerMailReceiver' => 'applications/ponder/mail/PonderAnswerMailReceiver.php',
'PonderAnswerPHIDType' => 'applications/ponder/phid/PonderAnswerPHIDType.php',
'PonderAnswerQuery' => 'applications/ponder/query/PonderAnswerQuery.php',
+ 'PonderAnswerReplyHandler' => 'applications/ponder/mail/PonderAnswerReplyHandler.php',
'PonderAnswerSaveController' => 'applications/ponder/controller/PonderAnswerSaveController.php',
'PonderAnswerStatus' => 'applications/ponder/constants/PonderAnswerStatus.php',
'PonderAnswerTransaction' => 'applications/ponder/storage/PonderAnswerTransaction.php',
@@ -7579,8 +7581,10 @@
'PonderAnswerEditor' => 'PonderEditor',
'PonderAnswerHasVotingUserEdgeType' => 'PhabricatorEdgeType',
'PonderAnswerHistoryController' => 'PonderController',
+ 'PonderAnswerMailReceiver' => 'PhabricatorObjectMailReceiver',
'PonderAnswerPHIDType' => 'PhabricatorPHIDType',
'PonderAnswerQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PonderAnswerReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PonderAnswerSaveController' => 'PonderController',
'PonderAnswerStatus' => 'PonderConstants',
'PonderAnswerTransaction' => 'PhabricatorApplicationTransaction',
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
@@ -177,30 +177,13 @@
return true;
}
- protected function getFeedStoryType() {
- return 'PonderTransactionFeedStory';
- }
-
- protected function getFeedStoryData(
- PhabricatorLiskDAO $object,
- array $xactions) {
-
- $data = parent::getFeedStoryData($object, $xactions);
- $answer = $this->getAnswer();
- if ($answer) {
- $data['answerPHID'] = $answer->getPHID();
- }
-
- return $data;
- }
-
protected function shouldImplyCC(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PonderQuestionTransaction::TYPE_ANSWERS:
- return true;
+ return false;
}
return parent::shouldImplyCC($object, $xaction);
@@ -209,7 +192,25 @@
protected function shouldSendMail(
PhabricatorLiskDAO $object,
array $xactions) {
- return true;
+ foreach ($xactions as $xaction) {
+ switch ($xaction->getTransactionType()) {
+ case PonderQuestionTransaction::TYPE_ANSWERS:
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected function shouldPublishFeedStory(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ foreach ($xactions as $xaction) {
+ switch ($xaction->getTransactionType()) {
+ case PonderQuestionTransaction::TYPE_ANSWERS:
+ return false;
+ }
+ }
+ return true;
}
public function getMailTagsMap() {
@@ -248,14 +249,6 @@
$body->addRawSection($new);
}
}
- // If the user gave an answer, add the answer text. Also update
- // the header and uri to be more answer-specific.
- if ($type == PonderQuestionTransaction::TYPE_ANSWERS) {
- $answer = $this->getAnswer();
- $body->addRawSection($answer->getContent());
- $header = pht('ANSWER DETAIL');
- $uri = $answer->getURI();
- }
}
$body->addLinkSection(
diff --git a/src/applications/ponder/mail/PonderAnswerMailReceiver.php b/src/applications/ponder/mail/PonderAnswerMailReceiver.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/mail/PonderAnswerMailReceiver.php
@@ -0,0 +1,27 @@
+<?php
+
+final class PonderAnswerMailReceiver extends PhabricatorObjectMailReceiver {
+
+ public function isEnabled() {
+ $app_class = 'PhabricatorPonderApplication';
+ return PhabricatorApplication::isClassInstalled($app_class);
+ }
+
+ protected function getObjectPattern() {
+ return 'ANSR[1-9]\d*';
+ }
+
+ protected function loadObject($pattern, PhabricatorUser $viewer) {
+ $id = (int)trim($pattern, 'ANSR');
+
+ return id(new PonderAnswerQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($id))
+ ->executeOne();
+ }
+
+ protected function getTransactionReplyHandler() {
+ return new PonderAnswerReplyHandler();
+ }
+
+}
diff --git a/src/applications/ponder/mail/PonderAnswerReplyHandler.php b/src/applications/ponder/mail/PonderAnswerReplyHandler.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/mail/PonderAnswerReplyHandler.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PonderAnswerReplyHandler
+ extends PhabricatorApplicationTransactionReplyHandler {
+
+ public function validateMailReceiver($mail_receiver) {
+ if (!($mail_receiver instanceof PonderAnswer)) {
+ throw new Exception(pht('Mail receiver is not a %s!', 'PonderAnswer'));
+ }
+ }
+
+ public function getObjectPrefix() {
+ return 'ANSR';
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 29, 1:17 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7717947
Default Alt Text
D13905.id33562.diff (5 KB)
Attached To
Mode
D13905: Add ability to reply to Ponder Answer emails
Attached
Detach File
Event Timeline
Log In to Comment