1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 19:22:42 +01:00

When an object is referenced by URI, treat it like a mention

Summary:
Ref T13291. Currently, `T123` is a mention and adds an "alice mentioned this on Txxx." to `T123`, but `https://install.com/T123` is not a mention.

Make the full URI a mention.

Test Plan: Commented a full URI, saw the target object get a mention story in its timeline.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13291

Differential Revision: https://secure.phabricator.com/D20527
This commit is contained in:
epriestley 2019-05-20 09:57:31 -07:00
parent b8f6248e07
commit 33688c8a41

View file

@ -53,11 +53,13 @@ final class PhabricatorSelfHyperlinkEngineExtension
} }
if ($object_map) { if ($object_map) {
$handles = $viewer->loadHandles(mpull($object_map, 'getPHID')); $object_phids = mpull($object_map, 'getPHID');
} else { } else {
$handles = array(); $object_phids = array();
} }
$handles = $viewer->loadHandles($object_phids);
foreach ($object_names as $key => $object_name) { foreach ($object_names as $key => $object_name) {
$object = idx($object_map, $object_name); $object = idx($object_map, $object_name);
if (!$object) { if (!$object) {
@ -83,6 +85,13 @@ final class PhabricatorSelfHyperlinkEngineExtension
unset($self_links[$key]); unset($self_links[$key]);
} }
$key_mentioned = PhabricatorObjectRemarkupRule::KEY_MENTIONED_OBJECTS;
$mentioned_phids = $engine->getTextMetadata($key_mentioned, array());
foreach ($object_phids as $object_phid) {
$mentioned_phids[$object_phid] = $object_phid;
}
$engine->setTextMetadata($key_mentioned, $mentioned_phids);
} }
} }