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');
|
|
|
|
|
2014-04-24 22:47:32 +02:00
|
|
|
return id(new DifferentialRevisionQuery())
|
2013-05-17 12:47:46 +02:00
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($id))
|
2014-03-07 17:10:18 +01:00
|
|
|
->needReviewerStatus(true)
|
2014-04-24 22:47:32 +02:00
|
|
|
->needReviewerAuthority(true)
|
|
|
|
->needActiveDiffs(true)
|
|
|
|
->executeOne();
|
2013-05-17 12:47:46 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|