From 6fea5e5ce7d592d24b16aec1c01915ad24118852 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 10 May 2022 11:50:18 -0700 Subject: [PATCH] Do not extract file PHIDs from remarkup blocks for attachment Summary: Ref T13603. When processing transactions that include remarkup blocks, stop extracting file references from them for attachment. Test Plan: Submitted a remarkup block with a file reference, no longer saw automatic file attachment. Maniphest Tasks: T13603 Differential Revision: https://secure.phabricator.com/D21812 --- ...atorApplicationTransactionCommentEditor.php | 18 ------------------ ...PhabricatorApplicationTransactionEditor.php | 8 -------- 2 files changed, 26 deletions(-) diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php index b2405d90c4..dea9e9e4f7 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php @@ -78,12 +78,6 @@ final class PhabricatorApplicationTransactionCommentEditor $comment->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC); $comment->setEditPolicy($this->getActingAsPHID()); - $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles( - $actor, - array( - $comment->getContent(), - )); - $xaction->openTransaction(); $xaction->beginReadLocking(); if ($xaction->getID()) { @@ -132,18 +126,6 @@ final class PhabricatorApplicationTransactionCommentEditor $xaction->endReadLocking(); $xaction->saveTransaction(); - // Add links to any files newly referenced by the edit. - if ($file_phids) { - $editor = new PhabricatorEdgeEditor(); - foreach ($file_phids as $file_phid) { - $editor->addEdge( - $xaction->getObjectPHID(), - PhabricatorObjectHasFileEdgeType::EDGECONST , - $file_phid); - } - $editor->save(); - } - return $this; } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 275636ca14..49636e0c77 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -4042,15 +4042,7 @@ abstract class PhabricatorApplicationTransactionEditor PhabricatorLiskDAO $object, array $xactions) { - $changes = $this->getRemarkupChanges($xactions); - $blocks = mpull($changes, 'getNewValue'); - $phids = array(); - if ($blocks) { - $phids[] = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles( - $this->getActor(), - $blocks); - } foreach ($xactions as $xaction) { $type = $xaction->getTransactionType(); -- 2.51.2