[COMPONENT][Notification] Support empty array of targets

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-10 04:01:57 +00:00
parent b89f57ce93
commit 60d31e097e
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 3 additions and 2 deletions

View File

@ -187,7 +187,8 @@ class Activity extends Entity
array_push($target_ids, ...$ids_already_known['additional']);
}
return DB::findBy('actor', ['id' => array_unique($target_ids)]);
$target_ids = array_unique($target_ids);
return $target_ids === [] ? [] : DB::findBy('actor', ['id' => $target_ids]);
}
public static function schemaDef(): array

View File

@ -350,7 +350,7 @@ class Note extends Entity
{
$rendered = null;
$mentions = [];
Event::handle('RenderNoteContent', [$this->getContent(), $this->getContentType(), &$rendered, &$mentions, $this->getActor(), Language::getById($this->getLanguageId())->getLocale()]);
Event::handle('RenderNoteContent', [$this->getContent(), $this->getContentType(), &$rendered, $this->getActor(), Language::getById($this->getLanguageId())->getLocale(), &$mentions]);
$mentioned = [];
foreach ($mentions as $mention) {
foreach ($mention['mentioned'] as $m) {