@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.createcomment` directly with transaction editor in Audit

Summary: Ref T4896. Use the new transaction-oriented `PhabricatorAuditEditor` directly instead of invoking it via the old editor.

Test Plan: Used Conduit to add a comment, use silent mode, and accept a commit.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4896

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

+16 -19
-7
src/applications/audit/editor/PhabricatorAuditCommentEditor.php
··· 4 4 5 5 private $commit; 6 6 private $attachInlineComments; 7 - private $noEmail; 8 7 9 8 public function __construct(PhabricatorRepositoryCommit $commit) { 10 9 $this->commit = $commit; ··· 13 12 14 13 public function setAttachInlineComments($attach_inline_comments) { 15 14 $this->attachInlineComments = $attach_inline_comments; 16 - return $this; 17 - } 18 - 19 - public function setNoEmail($no_email) { 20 - $this->noEmail = $no_email; 21 15 return $this; 22 16 } 23 17 ··· 62 56 ->setContinueOnMissingFields(true) 63 57 ->setContentSource($content_source) 64 58 ->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs()) 65 - ->setDisableEmail($this->noEmail) 66 59 ->applyTransactions($commit, $xactions); 67 60 } 68 61
+16 -12
src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
··· 59 59 $action = PhabricatorAuditActionConstants::COMMENT; 60 60 } 61 61 62 - // Disallow ADD_CCS, ADD_AUDITORS for now 62 + // Disallow ADD_CCS, ADD_AUDITORS forever. 63 63 if (!in_array($action, array( 64 64 PhabricatorAuditActionConstants::CONCERN, 65 65 PhabricatorAuditActionConstants::ACCEPT, ··· 70 70 throw new ConduitException('ERR_BAD_ACTION'); 71 71 } 72 72 73 - $comments = array(); 73 + $xactions = array(); 74 74 75 75 if ($action != PhabricatorAuditActionConstants::COMMENT) { 76 - $comments[] = id(new PhabricatorAuditComment()) 77 - ->setAction($action); 76 + $xactions[] = id(new PhabricatorAuditTransaction()) 77 + ->setTransactionType(PhabricatorAuditActionConstants::ACTION) 78 + ->setNewValue($action); 78 79 } 79 80 80 81 if (strlen($message)) { 81 - $comments[] = id(new PhabricatorAuditComment()) 82 - ->setAction(PhabricatorAuditActionConstants::COMMENT) 83 - ->setContent($message); 82 + $xactions[] = id(new PhabricatorAuditTransaction()) 83 + ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) 84 + ->attachComment( 85 + id(new PhabricatorAuditTransactionComment()) 86 + ->setCommitPHID($commit->getPHID()) 87 + ->setContent($message)); 84 88 } 85 89 86 - id(new PhabricatorAuditCommentEditor($commit)) 90 + id(new PhabricatorAuditEditor()) 87 91 ->setActor($request->getUser()) 88 - ->setNoEmail($request->getValue('silent')) 89 - ->addComments($comments); 92 + ->setContentSourceFromConduitRequest($request) 93 + ->setDisableEmail($request->getValue('silent')) 94 + ->setContinueOnMissingFields(true) 95 + ->applyTransactions($commit, $xactions); 90 96 91 97 return true; 92 - // get the full uri of the comment? 93 - // i.e, PhabricatorEnv::getURI(rXX01ab23cd#comment-9) 94 98 } 95 99 96 100 }