mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Subclass most ReplyHandlers from TransactionReplyHandler
Summary: Ref T7199. Half of these aren't even reachable, but make some progress toward reducing the amount of nonsense and garbage in mail handling. Test Plan: Tested all reachable handlers with `bin/mail receive-test`. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7199 Differential Revision: https://secure.phabricator.com/D12237
This commit is contained in:
parent
161f936871
commit
7c5f71b691
12 changed files with 57 additions and 252 deletions
|
@ -3943,7 +3943,7 @@ phutil_register_library_map(array(
|
|||
'FileInfoConduitAPIMethod' => 'FileConduitAPIMethod',
|
||||
'FileMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'FileQueryChunksConduitAPIMethod' => 'FileConduitAPIMethod',
|
||||
'FileReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'FileReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'FileUploadChunkConduitAPIMethod' => 'FileConduitAPIMethod',
|
||||
'FileUploadConduitAPIMethod' => 'FileConduitAPIMethod',
|
||||
'FileUploadHashConduitAPIMethod' => 'FileConduitAPIMethod',
|
||||
|
@ -3990,7 +3990,7 @@ phutil_register_library_map(array(
|
|||
'FundInitiativePHIDType' => 'PhabricatorPHIDType',
|
||||
'FundInitiativeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'FundInitiativeRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'FundInitiativeReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'FundInitiativeReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'FundInitiativeSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'FundInitiativeTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'FundInitiativeTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
|
@ -4217,7 +4217,7 @@ phutil_register_library_map(array(
|
|||
'LegalpadDocumentSignatureViewController' => 'LegalpadController',
|
||||
'LegalpadMockMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'LegalpadObjectNeedsSignatureEdgeType' => 'PhabricatorEdgeType',
|
||||
'LegalpadReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'LegalpadReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'LegalpadSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'LegalpadSignatureNeededByObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'LegalpadTransaction' => 'PhabricatorApplicationTransaction',
|
||||
|
@ -4613,7 +4613,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuditManagementDeleteWorkflow' => 'PhabricatorAuditManagementWorkflow',
|
||||
'PhabricatorAuditManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorAuditPreviewController' => 'PhabricatorAuditController',
|
||||
'PhabricatorAuditReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PhabricatorAuditReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PhabricatorAuditTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhabricatorAuditTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||
'PhabricatorAuditTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
|
@ -5278,7 +5278,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMacroMemeController' => 'PhabricatorMacroController',
|
||||
'PhabricatorMacroMemeDialogController' => 'PhabricatorMacroController',
|
||||
'PhabricatorMacroQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorMacroReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PhabricatorMacroReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PhabricatorMacroSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhabricatorMacroTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhabricatorMacroTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||
|
@ -6193,7 +6193,7 @@ phutil_register_library_map(array(
|
|||
'PholioMockThumbGridView' => 'AphrontView',
|
||||
'PholioMockViewController' => 'PholioController',
|
||||
'PholioRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'PholioReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PholioReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PholioSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PholioSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||
'PholioTransaction' => 'PhabricatorApplicationTransaction',
|
||||
|
@ -6229,7 +6229,7 @@ phutil_register_library_map(array(
|
|||
'PhortuneCartListController' => 'PhortuneController',
|
||||
'PhortuneCartPHIDType' => 'PhabricatorPHIDType',
|
||||
'PhortuneCartQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhortuneCartReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PhortuneCartReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PhortuneCartSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhortuneCartTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhortuneCartTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
|
@ -6425,7 +6425,7 @@ phutil_register_library_map(array(
|
|||
'PhrictionMoveController' => 'PhrictionController',
|
||||
'PhrictionNewController' => 'PhrictionController',
|
||||
'PhrictionRemarkupRule' => 'PhutilRemarkupRule',
|
||||
'PhrictionReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PhrictionReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PhrictionSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PhrictionSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhrictionSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||
|
@ -6481,7 +6481,7 @@ phutil_register_library_map(array(
|
|||
'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'PonderQuestionPHIDType' => 'PhabricatorPHIDType',
|
||||
'PonderQuestionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PonderQuestionReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PonderQuestionReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'PonderQuestionSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PonderQuestionStatus' => 'PonderConstants',
|
||||
'PonderQuestionStatusController' => 'PonderController',
|
||||
|
@ -6594,7 +6594,7 @@ phutil_register_library_map(array(
|
|||
'ReleephRequestMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'ReleephRequestPHIDType' => 'PhabricatorPHIDType',
|
||||
'ReleephRequestQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'ReleephRequestReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'ReleephRequestReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
'ReleephRequestSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'ReleephRequestTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'ReleephRequestTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorAuditReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class PhabricatorAuditReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PhabricatorRepositoryCommit)) {
|
||||
|
@ -8,43 +9,10 @@ final class PhabricatorAuditReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'C');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('C');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
$commit = $this->getMailReceiver();
|
||||
$actor = $this->getActor();
|
||||
$message = $mail->getCleanTextBody();
|
||||
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_EMAIL,
|
||||
array(
|
||||
'id' => $mail->getID(),
|
||||
));
|
||||
|
||||
// TODO: Support !raise, !accept, etc.
|
||||
|
||||
$xactions = array();
|
||||
|
||||
$xactions[] = id(new PhabricatorAuditTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
|
||||
->attachComment(
|
||||
id(new PhabricatorAuditTransactionComment())
|
||||
->setCommitPHID($commit->getPHID())
|
||||
->setContent($message));
|
||||
|
||||
$editor = id(new PhabricatorAuditEditor())
|
||||
->setActor($actor)
|
||||
->setContentSource($content_source)
|
||||
->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs())
|
||||
->setContinueOnMissingFields(true)
|
||||
->applyTransactions($commit, $xactions);
|
||||
public function getObjectPrefix() {
|
||||
// TODO: This conflicts with Countdown and will probably need to be
|
||||
// changed eventually.
|
||||
return 'C';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class FileReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class FileReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PhabricatorFile)) {
|
||||
|
@ -8,31 +9,14 @@ final class FileReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'F');
|
||||
public function getObjectPrefix() {
|
||||
return 'F';
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('F');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
$actor = $this->getActor();
|
||||
$file = $this->getMailReceiver();
|
||||
|
||||
$body_data = $mail->parseBody();
|
||||
$body = $body_data['body'];
|
||||
$body = $this->enhanceBodyWithAttachments($body, $mail->getAttachments());
|
||||
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_EMAIL,
|
||||
array(
|
||||
'id' => $mail->getID(),
|
||||
));
|
||||
protected function processMailCommands(array $commands) {
|
||||
$actor = $this->getActor();
|
||||
|
||||
$xactions = array();
|
||||
$commands = $body_data['commands'];
|
||||
foreach ($commands as $command) {
|
||||
switch (head($command)) {
|
||||
case 'unsubscribe':
|
||||
|
@ -44,19 +28,7 @@ final class FileReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
$xactions[] = id(new PhabricatorFileTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
|
||||
->attachComment(
|
||||
id(new PhabricatorFileTransactionComment())
|
||||
->setContent($body));
|
||||
|
||||
$editor = id(new PhabricatorFileEditor())
|
||||
->setActor($actor)
|
||||
->setContentSource($content_source)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setIsPreview(false);
|
||||
|
||||
$editor->applyTransactions($file, $xactions);
|
||||
return $xactions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class FundInitiativeReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class FundInitiativeReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof FundInitiative)) {
|
||||
|
@ -8,18 +9,8 @@ final class FundInitiativeReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'I');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('I');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
// TODO: Implement.
|
||||
return null;
|
||||
public function getObjectPrefix() {
|
||||
return 'I';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class LegalpadReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class LegalpadReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof LegalpadDocument)) {
|
||||
|
@ -8,59 +9,8 @@ final class LegalpadReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'L');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('L');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
$actor = $this->getActor();
|
||||
$document = $this->getMailReceiver();
|
||||
|
||||
$body_data = $mail->parseBody();
|
||||
$body = $body_data['body'];
|
||||
$body = $this->enhanceBodyWithAttachments($body, $mail->getAttachments());
|
||||
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_EMAIL,
|
||||
array(
|
||||
'id' => $mail->getID(),
|
||||
));
|
||||
|
||||
$xactions = array();
|
||||
|
||||
$commands = $body_data['commands'];
|
||||
foreach ($commands as $command) {
|
||||
switch (head($command)) {
|
||||
case 'unsubscribe':
|
||||
$xaction = id(new LegalpadTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
|
||||
->setNewValue(array('-' => array($actor->getPHID())));
|
||||
$xactions[] = $xaction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$xactions[] = id(new LegalpadTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
|
||||
->attachComment(
|
||||
id(new LegalpadTransactionComment())
|
||||
->setDocumentID($document->getID())
|
||||
->setLineNumber(0)
|
||||
->setLineLength(0)
|
||||
->setContent($body));
|
||||
|
||||
$editor = id(new LegalpadDocumentEditor())
|
||||
->setActor($actor)
|
||||
->setContentSource($content_source)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setIsPreview(false);
|
||||
|
||||
$editor->applyTransactions($document, $xactions);
|
||||
public function getObjectPrefix() {
|
||||
return 'L';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ final class LegalpadTransactionComment
|
|||
extends PhabricatorApplicationTransactionComment {
|
||||
|
||||
protected $documentID;
|
||||
protected $lineNumber;
|
||||
protected $lineLength;
|
||||
protected $lineNumber = 0;
|
||||
protected $lineLength = 0;
|
||||
protected $fixedState;
|
||||
protected $hasReplies = 0;
|
||||
protected $replyToCommentPHID;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorMacroReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class PhabricatorMacroReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PhabricatorFileImageMacro)) {
|
||||
|
@ -8,18 +9,8 @@ final class PhabricatorMacroReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'MCRO');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('MCRO');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
// TODO: Implement this.
|
||||
return null;
|
||||
public function getObjectPrefix() {
|
||||
return 'MCRO';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class PholioReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class PholioReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PholioMock)) {
|
||||
|
@ -8,18 +9,8 @@ final class PholioReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'M');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('M');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
// TODO: Implement this.
|
||||
return null;
|
||||
public function getObjectPrefix() {
|
||||
return 'M';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class PhortuneCartReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class PhortuneCartReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PhortuneCart)) {
|
||||
|
@ -8,18 +9,8 @@ final class PhortuneCartReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'CART');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('CART');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
// TODO: Implement.
|
||||
return null;
|
||||
public function getObjectPrefix() {
|
||||
return 'CART';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class PhrictionReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class PhrictionReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PhrictionDocument)) {
|
||||
|
@ -8,21 +9,8 @@ final class PhrictionReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress(
|
||||
$handle,
|
||||
PhrictionDocumentPHIDType::TYPECONST);
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress(
|
||||
PhrictionDocumentPHIDType::TYPECONST);
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
// TODO: Implement.
|
||||
return null;
|
||||
public function getObjectPrefix() {
|
||||
return PhrictionDocumentPHIDType::TYPECONST;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class PonderQuestionReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class PonderQuestionReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PonderQuestion)) {
|
||||
|
@ -8,16 +9,8 @@ final class PonderQuestionReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'Q');
|
||||
public function getObjectPrefix() {
|
||||
return 'Q';
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('Q');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
// ignore this entirely for now
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class ReleephRequestReplyHandler extends PhabricatorMailReplyHandler {
|
||||
final class ReleephRequestReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof ReleephRequest)) {
|
||||
|
@ -8,39 +9,8 @@ final class ReleephRequestReplyHandler extends PhabricatorMailReplyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public function getPrivateReplyHandlerEmailAddress(
|
||||
PhabricatorObjectHandle $handle) {
|
||||
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'Y');
|
||||
}
|
||||
|
||||
public function getPublicReplyHandlerEmailAddress() {
|
||||
return $this->getDefaultPublicReplyHandlerEmailAddress('Y');
|
||||
}
|
||||
|
||||
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
|
||||
$rq = $this->getMailReceiver();
|
||||
$user = $this->getActor();
|
||||
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_EMAIL,
|
||||
array(
|
||||
'id' => $mail->getID(),
|
||||
));
|
||||
|
||||
$body = $mail->getCleanTextBody();
|
||||
|
||||
$xactions = array();
|
||||
$xactions[] = id(new ReleephRequestTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
|
||||
->attachComment($body);
|
||||
|
||||
$editor = id(new ReleephRequestTransactionalEditor())
|
||||
->setActor($user)
|
||||
->setContentSource($content_source)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setParentMessageID($mail->getMessageID());
|
||||
|
||||
$editor->applyTransactions($rq, $xactions);
|
||||
public function getObjectPrefix() {
|
||||
return 'Y';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue