mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Transactions - don't let objects mention themselves.
Summary: Fixes T6059. Test Plan: Made a comment on TX mentioning TX and TX+1. TX did not get a "mentioned" transaction while TX+1 did. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T6059 Differential Revision: https://secure.phabricator.com/D10464
This commit is contained in:
parent
568b0e06e7
commit
13834f1406
1 changed files with 10 additions and 5 deletions
|
@ -1199,18 +1199,23 @@ abstract class PhabricatorApplicationTransactionEditor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$objects = id(new PhabricatorObjectQuery())
|
$mentioned_objects = id(new PhabricatorObjectQuery())
|
||||||
->setViewer($this->getActor())
|
->setViewer($this->getActor())
|
||||||
->withPHIDs($mentioned_phids)
|
->withPHIDs($mentioned_phids)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$mentionable_phids = array();
|
$mentionable_phids = array();
|
||||||
foreach ($objects as $object) {
|
foreach ($mentioned_objects as $mentioned_object) {
|
||||||
if ($object instanceof PhabricatorMentionableInterface) {
|
if ($mentioned_object instanceof PhabricatorMentionableInterface) {
|
||||||
if (idx($this->getUnmentionablePHIDMap(), $object->getPHID())) {
|
$mentioned_phid = $mentioned_object->getPHID();
|
||||||
|
if (idx($this->getUnmentionablePHIDMap(), $mentioned_phid)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$mentionable_phids[$object->getPHID()] = $object->getPHID();
|
// don't let objects mention themselves
|
||||||
|
if ($object->getPHID() && $mentioned_phid == $object->getPHID()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$mentionable_phids[$mentioned_phid] = $mentioned_phid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($mentionable_phids) {
|
if ($mentionable_phids) {
|
||||||
|
|
Loading…
Reference in a new issue