mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
Reduces friction with flarum/tags (#25)
Instead of blatantly triggering a 500 let's try to see whether the tags relation is even returning anything before we try to pluck tag ids from it when we publish that data to the pusher server.
This commit is contained in:
parent
2e1c8d79d4
commit
619796b102
|
@ -28,10 +28,12 @@ class PushNewPost
|
|||
public function handle(Posted $event)
|
||||
{
|
||||
if ($event->post->isVisibleTo(new Guest)) {
|
||||
$tags = $event->post->discussion->tags;
|
||||
|
||||
$this->pusher->trigger('public', 'newPost', [
|
||||
'postId' => $event->post->id,
|
||||
'discussionId' => $event->post->discussion->id,
|
||||
'tagIds' => $event->post->discussion->tags()->pluck('id')
|
||||
'tagIds' => $tags ? $tags->pluck('id') : null
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user