[COMPONENT][Posting] Add facility to allow mentioning groups that don't yet exist

This commit is contained in:
2021-12-21 12:07:54 +00:00
parent 36976d8fe7
commit 315fd95b94
3 changed files with 23 additions and 15 deletions

View File

@@ -220,25 +220,27 @@ class Posting extends Component
}
}
$act = Activity::create([
$activity = Activity::create([
'actor_id' => $actor->getId(),
'verb' => 'create',
'object_type' => 'note',
'object_id' => $note->getId(),
'source' => 'web',
]);
DB::persist($act);
DB::persist($activity);
DB::flush();
$mentioned = [];
foreach ($mentions as $mention) {
foreach ($mention['mentioned'] as $m) {
$mentioned[] = $m->getId();
if (!\is_null($m)) {
$mentioned[] = $m->getId();
}
}
}
Event::handle('NewNotification', [$actor, $act, ['object' => $mentioned], "{$actor->getNickname()} created note {$note->getUrl()}"]);
Event::handle('NewNotification', [$actor, $activity, ['object' => $mentioned], "{$actor->getNickname()} created note {$note->getUrl()}"]);
return $note;
}