From c52e10d1ecf06b7077a190eab8dd05d5f9107d4a Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 12 Apr 2018 14:58:57 -0700 Subject: [PATCH] Respect external unmentionable PHIDs in Differential revision editor Summary: See PHI574. Ref T13120. When you `Ref Txx` or `Fixes Txxx`, we mark it "unmentionable" to prevent the task from generating both a reference and a mention. If you add a reference to an object (like a commit hash) to a custom remarkup field, there's currently no real way to prevent it from generating a mention, except that you can explicitly mark the PHID as unmentionable on the Editor. This isn't exactly a first-class feature, but we technically do it in `PhabricatorRepositoryCommitMessageParserWorker`, and it probably doesn't hurt or interfere with anything to support it slightly better. In Differential, respect any existing value and append new values to it rather than overwriting the value. Test Plan: Edited a revision summary to include `Ref Txxx`, saw only a reference (not a mention) generate. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13120 Differential Revision: https://secure.phabricator.com/D19361 --- .../editor/DifferentialTransactionEditor.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 24f0fe7a07..50094b02f4 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -850,11 +850,13 @@ final class DifferentialTransactionEditor $revert_phids = array(); } - $this->setUnmentionablePHIDMap( - array_merge( - $task_phids, - $rev_phids, - $revert_phids)); + // See PHI574. Respect any unmentionable PHIDs which were set on the + // Editor by the caller. + $unmentionable_map = $this->getUnmentionablePHIDMap(); + $unmentionable_map += $task_phids; + $unmentionable_map += $rev_phids; + $unmentionable_map += $revert_phids; + $this->setUnmentionablePHIDMap($unmentionable_map); $result = array(); foreach ($edges as $type => $specs) {