1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-12 00:26:13 +01:00
phorge-phorge/src/applications/releeph/mail/ReleephRequestReplyHandler.php

47 lines
1.3 KiB
PHP
Raw Normal View History

<?php
final class ReleephRequestReplyHandler extends PhabricatorMailReplyHandler {
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof ReleephRequest)) {
throw new Exception('Mail receiver is not a ReleephRequest!');
}
}
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);
}
}