From 85ae0983d42a224bc0a60b614ea7a1ff873903b0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Apr 2022 15:20:46 +0200 Subject: [PATCH] Use actor and time information from the reaction not the message author Signed-off-by: Joas Schilling --- lib/Chat/Notifier.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php index b909319023a..7891db27333 100644 --- a/lib/Chat/Notifier.php +++ b/lib/Chat/Notifier.php @@ -282,7 +282,7 @@ public function notifyReacted(Room $chat, IComment $comment, IComment $reaction) if ($notificationLevel === Participant::NOTIFY_ALWAYS) { $notification = $this->createNotification($chat, $comment, 'reaction', [ 'reaction' => $reaction->getMessage(), - ]); + ], $reaction); $notification->setUser($comment->getActorId()); $this->notificationManager->notify($notification); } @@ -388,9 +388,9 @@ private function getMentionedUsers(IComment $comment): array { * @param array $subjectData * @return INotification */ - private function createNotification(Room $chat, IComment $comment, string $subject, array $subjectData = []): INotification { - $subjectData['userType'] = $comment->getActorType(); - $subjectData['userId'] = $comment->getActorId(); + private function createNotification(Room $chat, IComment $comment, string $subject, array $subjectData = [], ?IComment $reaction = null): INotification { + $subjectData['userType'] = $reaction ? $reaction->getActorType() : $comment->getActorType(); + $subjectData['userId'] = $reaction ? $reaction->getActorId() : $comment->getActorId(); $notification = $this->notificationManager->createNotification(); $notification @@ -400,7 +400,7 @@ private function createNotification(Room $chat, IComment $comment, string $subje ->setMessage($comment->getVerb(), [ 'commentId' => $comment->getId(), ]) - ->setDateTime($comment->getCreationDateTime()); + ->setDateTime($reaction ? $reaction->getCreationDateTime() : $comment->getCreationDateTime()); return $notification; }