[ENTITY][Note] Only attempt to find mentions if we have content

This commit is contained in:
Hugo Sales 2022-01-17 20:45:47 +00:00
parent 4717dde12e
commit 145c88d43f
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 7 additions and 4 deletions

View File

@ -430,11 +430,14 @@ class Note extends Entity
{
$target_ids = $this->object_mentions_ids ?? [];
if ($target_ids === []) {
$content = $this->getContent();
if (!\array_key_exists('object', $ids_already_known)) {
$mentions = Formatting::findMentions($this->getContent(), $this->getActor());
foreach ($mentions as $mention) {
foreach ($mention['mentioned'] as $m) {
$target_ids[] = $m->getId();
if (!\is_null($content)) {
$mentions = Formatting::findMentions($content, $this->getActor());
foreach ($mentions as $mention) {
foreach ($mention['mentioned'] as $m) {
$target_ids[] = $m->getId();
}
}
}
} else {