2013-05-14 19:57:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class ManiphestTaskMailReceiver extends PhabricatorObjectMailReceiver {
|
|
|
|
|
|
|
|
public function isEnabled() {
|
2014-07-23 02:03:09 +02:00
|
|
|
$app_class = 'PhabricatorManiphestApplication';
|
2013-05-14 19:57:41 +02:00
|
|
|
return PhabricatorApplication::isClassInstalled($app_class);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectPattern() {
|
|
|
|
return 'T[1-9]\d*';
|
|
|
|
}
|
|
|
|
|
2013-05-17 12:47:46 +02:00
|
|
|
protected function loadObject($pattern, PhabricatorUser $viewer) {
|
|
|
|
$id = (int)trim($pattern, 'T');
|
|
|
|
|
|
|
|
$results = id(new ManiphestTaskQuery())
|
|
|
|
->setViewer($viewer)
|
2013-09-10 16:47:55 +02:00
|
|
|
->withIDs(array($id))
|
2013-05-17 12:47:46 +02:00
|
|
|
->execute();
|
|
|
|
|
|
|
|
return head($results);
|
|
|
|
}
|
|
|
|
|
2013-05-17 19:00:49 +02:00
|
|
|
protected function processReceivedObjectMail(
|
|
|
|
PhabricatorMetaMTAReceivedMail $mail,
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorUser $sender) {
|
|
|
|
|
2013-10-22 01:58:37 +02:00
|
|
|
$handler = PhabricatorEnv::newObjectFromConfig(
|
|
|
|
'metamta.maniphest.reply-handler');
|
|
|
|
$handler->setMailReceiver($object);
|
2013-05-17 19:00:49 +02:00
|
|
|
|
|
|
|
$handler->setActor($sender);
|
|
|
|
$handler->setExcludeMailRecipientPHIDs(
|
|
|
|
$mail->loadExcludeMailRecipientPHIDs());
|
|
|
|
$handler->processEmail($mail);
|
|
|
|
}
|
|
|
|
|
2013-05-14 19:57:41 +02:00
|
|
|
}
|