Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18621228
D20544.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D20544.diff
View Options
diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php
--- a/src/applications/audit/editor/PhabricatorAuditEditor.php
+++ b/src/applications/audit/editor/PhabricatorAuditEditor.php
@@ -239,7 +239,7 @@
$object);
if ($request) {
$xactions[] = $request;
- $this->setUnmentionablePHIDMap($request->getNewValue());
+ $this->addUnmentionablePHIDs($request->getNewValue());
}
break;
default:
@@ -360,7 +360,6 @@
$flat_blocks = mpull($changes, 'getNewValue');
$huge_block = implode("\n\n", $flat_blocks);
$phid_map = array();
- $phid_map[] = $this->getUnmentionablePHIDMap();
$monograms = array();
$task_refs = id(new ManiphestCustomFieldStatusParser())
@@ -385,7 +384,6 @@
->execute();
$phid_map[] = mpull($objects, 'getPHID', 'getPHID');
-
$reverts_refs = id(new DifferentialCustomFieldRevertsParser())
->parseCorpus($huge_block);
$reverts = array_mergev(ipull($reverts_refs, 'monograms'));
@@ -408,7 +406,7 @@
}
$phid_map = array_mergev($phid_map);
- $this->setUnmentionablePHIDMap($phid_map);
+ $this->addUnmentionablePHIDs($phid_map);
return $result;
}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -846,13 +846,9 @@
$revert_phids = array();
}
- // 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);
+ $this->addUnmentionablePHIDs($task_phids);
+ $this->addUnmentionablePHIDs($rev_phids);
+ $this->addUnmentionablePHIDs($revert_phids);
$result = array();
foreach ($edges as $type => $specs) {
diff --git a/src/applications/diffusion/worker/DiffusionUpdateObjectAfterCommitWorker.php b/src/applications/diffusion/worker/DiffusionUpdateObjectAfterCommitWorker.php
--- a/src/applications/diffusion/worker/DiffusionUpdateObjectAfterCommitWorker.php
+++ b/src/applications/diffusion/worker/DiffusionUpdateObjectAfterCommitWorker.php
@@ -139,10 +139,7 @@
->setContentSource($content_source)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
- ->setUnmentionablePHIDMap(
- array(
- $commit_phid => $commit_phid,
- ));
+ ->addUnmentionablePHIDs(array($commit_phid));
$editor->applyTransactions($task, $xactions);
}
diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php
--- a/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php
+++ b/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php
@@ -62,12 +62,25 @@
$acting_phid = $this->getPublishAsPHID($commit);
$content_source = $this->newContentSource();
+ $revision = DiffusionCommitRevisionQuery::loadRevisionForCommit(
+ $viewer,
+ $commit);
+
+ // Prevent the commit from generating a mention of the associated
+ // revision, if one exists, so we don't double up because of the URI
+ // in the commit message.
+ $unmentionable_phids = array();
+ if ($revision) {
+ $unmentionable_phids[] = $revision->getPHID();
+ }
+
$editor = $commit->getApplicationTransactionEditor()
->setActor($viewer)
->setActingAsPHID($acting_phid)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
- ->setContentSource($content_source);
+ ->setContentSource($content_source)
+ ->addUnmentionablePHIDs($unmentionable_phids);
try {
$raw_patch = $this->loadRawPatchText($repository, $commit);
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -260,12 +260,14 @@
return $this->isHeraldEditor;
}
- public function setUnmentionablePHIDMap(array $map) {
- $this->unmentionablePHIDMap = $map;
+ public function addUnmentionablePHIDs(array $phids) {
+ foreach ($phids as $phid) {
+ $this->unmentionablePHIDMap[$phid] = true;
+ }
return $this;
}
- public function getUnmentionablePHIDMap() {
+ private function getUnmentionablePHIDMap() {
return $this->unmentionablePHIDMap;
}
@@ -2090,12 +2092,14 @@
->withPHIDs($mentioned_phids)
->execute();
+ $unmentionable_map = $this->getUnmentionablePHIDMap();
+
$mentionable_phids = array();
if ($this->shouldEnableMentions($object, $xactions)) {
foreach ($mentioned_objects as $mentioned_object) {
if ($mentioned_object instanceof PhabricatorMentionableInterface) {
$mentioned_phid = $mentioned_object->getPHID();
- if (idx($this->getUnmentionablePHIDMap(), $mentioned_phid)) {
+ if (isset($unmentionable_map[$mentioned_phid])) {
continue;
}
// don't let objects mention themselves
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sep 16 2025, 7:26 AM (7 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8574781
Default Alt Text
D20544.diff (5 KB)
Attached To
Mode
D20544: Prevent "Differential Revision: ..." from counting as a mention in commit messages
Attached
Detach File
Event Timeline
Log In to Comment