@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Apply Diffusion reply email directly with transaction editor

Summary: Ref T4896. Invoke the new editor directly instead of in a roundabout way when handling Audit email.

Test Plan: Used `bin/mail receive-test` to simulate mail, saw comment post with proper content source.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4896

Differential Revision: https://secure.phabricator.com/D10127

+21 -9
+21 -9
src/applications/audit/mail/PhabricatorAuditReplyHandler.php
··· 33 33 protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { 34 34 $commit = $this->getMailReceiver(); 35 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 + )); 36 43 37 44 // TODO: Support !raise, !accept, etc. 38 - // TODO: Content sources. 39 45 40 - $comment = id(new PhabricatorAuditComment()) 41 - ->setAction(PhabricatorAuditActionConstants::COMMENT) 42 - ->setContent($mail->getCleanTextBody()); 46 + $xactions = array(); 43 47 44 - $editor = new PhabricatorAuditCommentEditor($commit); 45 - $editor->setActor($actor); 46 - $editor->setExcludeMailRecipientPHIDs( 47 - $this->getExcludeMailRecipientPHIDs()); 48 - $editor->addComments(array($comment)); 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($commit)) 56 + ->setActor($actor) 57 + ->setContentSource($content_source) 58 + ->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs()) 59 + ->setContinueOnMissingFields(true) 60 + ->applyTransactions($commit, $xactions); 49 61 } 50 62 51 63 }