2013-05-14 19:57:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialRevisionMailReceiver
|
|
|
|
extends PhabricatorObjectMailReceiver {
|
|
|
|
|
|
|
|
public function isEnabled() {
|
|
|
|
$app_class = 'PhabricatorApplicationDifferential';
|
|
|
|
return PhabricatorApplication::isClassInstalled($app_class);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectPattern() {
|
|
|
|
return 'D[1-9]\d*';
|
|
|
|
}
|
|
|
|
|
2013-05-17 12:47:46 +02:00
|
|
|
protected function loadObject($pattern, PhabricatorUser $viewer) {
|
|
|
|
$id = (int)trim($pattern, 'D');
|
|
|
|
|
|
|
|
$results = id(new DifferentialRevisionQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($id))
|
2014-03-07 17:10:18 +01:00
|
|
|
->needReviewerStatus(true)
|
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) {
|
|
|
|
|
|
|
|
$handler = DifferentialMail::newReplyHandlerForRevision($object);
|
|
|
|
|
|
|
|
$handler->setActor($sender);
|
|
|
|
$handler->setExcludeMailRecipientPHIDs(
|
|
|
|
$mail->loadExcludeMailRecipientPHIDs());
|
|
|
|
$handler->processEmail($mail);
|
|
|
|
}
|
2013-05-17 12:47:46 +02:00
|
|
|
|
2013-05-14 19:57:41 +02:00
|
|
|
}
|