From 92d30b9e71de4c90054490d52c3be0f3a95ef1af Mon Sep 17 00:00:00 2001 From: YUCLing Date: Fri, 25 Oct 2024 13:47:58 +0800 Subject: [PATCH] fix(likes): notification for non-string post likes --- .../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 401394048d..0d148586c8 100755 --- a/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php +++ b/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php @@ -22,7 +22,7 @@ public function __construct( public function handle(PostWasLiked $event): void { - if ($event->post->user && $event->post->user->id != $event->user->id) { + if (gettype($event->post->content) == "string" && $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 5a9b97733b..f590f8317b 100755 --- a/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php +++ b/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php @@ -22,7 +22,7 @@ public function __construct( public function handle(PostWasUnliked $event): void { - if ($event->post->user && $event->post->user->id != $event->user->id) { + if (gettype($event->post->content) == "string" && $event->post->user && $event->post->user->id != $event->user->id) { $this->notifications->sync( new PostLikedBlueprint($event->post, $event->user), []