[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/audit/mail/ -> PhabricatorAuditReplyHandler.php (source)

   1  <?php
   2  
   3  final class PhabricatorAuditReplyHandler extends PhabricatorMailReplyHandler {
   4  
   5    public function validateMailReceiver($mail_receiver) {
   6      if (!($mail_receiver instanceof PhabricatorRepositoryCommit)) {
   7        throw new Exception('Mail receiver is not a commit!');
   8      }
   9    }
  10  
  11    public function getPrivateReplyHandlerEmailAddress(
  12      PhabricatorObjectHandle $handle) {
  13      return $this->getDefaultPrivateReplyHandlerEmailAddress($handle, 'C');
  14    }
  15  
  16    public function getPublicReplyHandlerEmailAddress() {
  17      return $this->getDefaultPublicReplyHandlerEmailAddress('C');
  18    }
  19  
  20    public function getReplyHandlerDomain() {
  21      return PhabricatorEnv::getEnvConfig(
  22        'metamta.diffusion.reply-handler-domain');
  23    }
  24  
  25    public function getReplyHandlerInstructions() {
  26      if ($this->supportsReplies()) {
  27        return pht('Reply to comment.');
  28      } else {
  29        return null;
  30      }
  31    }
  32  
  33    protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
  34      $commit = $this->getMailReceiver();
  35      $actor = $this->getActor();
  36      $message = $mail->getCleanTextBody();
  37  
  38      $content_source = PhabricatorContentSource::newForSource(
  39        PhabricatorContentSource::SOURCE_EMAIL,
  40        array(
  41          'id' => $mail->getID(),
  42        ));
  43  
  44      // TODO: Support !raise, !accept, etc.
  45  
  46      $xactions = array();
  47  
  48      $xactions[] = id(new PhabricatorAuditTransaction())
  49        ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
  50        ->attachComment(
  51          id(new PhabricatorAuditTransactionComment())
  52            ->setCommitPHID($commit->getPHID())
  53            ->setContent($message));
  54  
  55      $editor = id(new PhabricatorAuditEditor())
  56        ->setActor($actor)
  57        ->setContentSource($content_source)
  58        ->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs())
  59        ->setContinueOnMissingFields(true)
  60        ->applyTransactions($commit, $xactions);
  61    }
  62  
  63  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1