[NOTIFICATION] Implement Target Collector

This commit is contained in:
2021-11-27 04:12:44 +00:00
parent 51994406da
commit 7b9d388a44
11 changed files with 423 additions and 78 deletions

View File

@@ -26,8 +26,10 @@ namespace App\Entity;
use App\Core\Cache;
use App\Core\DB\DB;
use App\Core\Entity;
use App\Core\Event;
use App\Core\VisibilityScope;
use Component\Avatar\Avatar;
use Component\Notification\Entity\Notification;
use DateTimeInterface;
/**
@@ -298,6 +300,19 @@ class Note extends Entity
));
}
public function getNotificationTargets(array $ids_already_known = []): array
{
$mentions = [];
Event::handle('RenderNoteContent', [$this->getContent(), $this->getContentType(), &$rendered, &$mentions, $this->getActor(), Language::getFromId($this->getLanguageId())->getLocale()]);
$mentioned = [];
foreach ($mentions as $mention) {
foreach ($mention['mentioned'] as $m) {
$mentioned[] = $m;
}
}
return $mentioned;
}
public static function schemaDef(): array
{
return [