From 92d30b9e71de4c90054490d52c3be0f3a95ef1af Mon Sep 17 00:00:00 2001 From: YUCLing Date: Fri, 25 Oct 2024 13:47:58 +0800 Subject: [PATCH 1/2] 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), [] From ccded0d9570b8c56915937f0d0e2e92e27652d7b Mon Sep 17 00:00:00 2001 From: YUCLing Date: Fri, 25 Oct 2024 13:57:20 +0800 Subject: [PATCH 2/2] fix: quote styles --- .../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 0d148586c8..d74959b0a8 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 (gettype($event->post->content) == "string" && $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 f590f8317b..6861551e66 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 (gettype($event->post->content) == "string" && $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), []