2013-04-08 17:34:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class ReleephRequestReplyHandler extends PhabricatorMailReplyHandler {
|
|
|
|
|
|
|
|
public function validateMailReceiver($mail_receiver) {
|
|
|
|
if (!($mail_receiver instanceof ReleephRequest)) {
|
2014-06-09 20:36:49 +02:00
|
|
|
throw new Exception('Mail receiver is not a ReleephRequest!');
|
2013-04-08 17:34:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPrivateReplyHandlerEmailAddress(
|
|
|
|
PhabricatorObjectHandle $handle) {
|
2015-04-01 01:48:27 +02:00
|
|
|
return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'Y');
|
2013-04-08 17:34:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getPublicReplyHandlerEmailAddress() {
|
2015-04-01 01:48:27 +02:00
|
|
|
return $this->getDefaultPublicReplyHandlerEmailAddress('Y');
|
2013-04-08 17:34:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2015-04-01 01:48:27 +02:00
|
|
|
$editor = id(new ReleephRequestTransactionalEditor())
|
|
|
|
->setActor($user)
|
|
|
|
->setContentSource($content_source)
|
|
|
|
->setContinueOnNoEffect(true)
|
|
|
|
->setParentMessageID($mail->getMessageID());
|
2013-04-08 17:34:21 +02:00
|
|
|
|
2015-04-01 01:48:27 +02:00
|
|
|
$editor->applyTransactions($rq, $xactions);
|
2013-04-08 17:34:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|