From 63e7441c264c4339f3b9ce68fe470b80d166fe8a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 17 Sep 2025 12:29:13 +0200 Subject: [PATCH] fix(threads): Correctly build parameter list Signed-off-by: Joas Schilling --- lib/Notification/Notifier.php | 11 ++++++++--- lib/Search/MessageSearch.php | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 9574b52df2..5e6b63f7e1 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -603,9 +603,14 @@ class Notifier implements INotifier { ]; // Set the link to the specific message - $notification->setLink($this->url->linkToRouteAbsolute('spreed.Page.showCall', ['token' => $room->getToken()]) - . (isset($messageParameters['threadId']) ? '?threadId=' . $messageParameters['threadId'] : '') - . '#message_' . $message->getMessageId()); + $urlParams = [ + 'token' => $room->getToken(), + '_fragment' => 'message_' . $message->getMessageId(), + ]; + if (isset($messageParameters['threadId'])) { + $urlParams['threadId'] = $messageParameters['threadId']; + } + $notification->setLink($this->url->linkToRouteAbsolute('spreed.Page.showCall', $urlParams)); $now = $this->timeFactory->getDateTime(); $expireDate = $message->getExpirationDateTime(); diff --git a/lib/Search/MessageSearch.php b/lib/Search/MessageSearch.php index 3e5f3feac4..ccaf12d001 100644 --- a/lib/Search/MessageSearch.php +++ b/lib/Search/MessageSearch.php @@ -285,12 +285,18 @@ class MessageSearch implements IProvider, IFilteringProvider { } } + $urlParams = [ + 'token' => $room->getToken(), + '_fragment' => 'message_' . $id, + ]; $threadId = (int)$comment->getTopmostParentId() ?: (int)$comment->getId(); try { $thread = $this->threadService->findByThreadId($room->getId(), $threadId); + $urlParams['threadId'] = $thread->getId(); } catch (DoesNotExistException) { $thread = null; } + $entry = new SearchResultEntry( $iconUrl, str_replace( @@ -299,9 +305,7 @@ class MessageSearch implements IProvider, IFilteringProvider { $subline ), $messageStr, - $this->url->linkToRouteAbsolute('spreed.Page.showCall', ['token' => $room->getToken()]) - . ($thread !== null ? '?threadId=' . $thread->getId() : '') - . '#message_' . $comment->getId(), + $this->url->linkToRouteAbsolute('spreed.Page.showCall', $urlParams), 'icon-talk', // $iconClass, true );