From 08bcdbd8da81c5f40539a1aac4d93ab8c8f33257 Mon Sep 17 00:00:00 2001 From: the-turk Date: Wed, 26 Feb 2020 20:13:12 +0300 Subject: [PATCH] notification fix --- .../likes/src/Listener/SendNotificationWhenPostIsLiked.php | 2 +- .../likes/src/Listener/SendNotificationWhenPostIsUnliked.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php b/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php index bb848f391..b687ff3e8 100755 --- a/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php +++ b/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php @@ -30,7 +30,7 @@ class SendNotificationWhenPostIsLiked public function handle(PostWasLiked $event) { - if ($event->post->user->id != $event->user->id) { + if ($event->post->user && $event->post->user->id != $event->user->id) { $this->notifications->sync( new PostLikedBlueprint($event->post, $event->user), [$event->post->user] diff --git a/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php b/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php index 981b3224b..78919d6a4 100755 --- a/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php +++ b/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php @@ -30,7 +30,7 @@ class SendNotificationWhenPostIsUnliked public function handle(PostWasUnliked $event) { - if ($event->post->user->id != $event->user->id) { + if ($event->post->user && $event->post->user->id != $event->user->id) { $this->notifications->sync( new PostLikedBlueprint($event->post, $event->user), []