From 1cf3b8a1322f6c1d3f43b1c2862319ff4b6e6cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 5 May 2023 15:37:39 +0200 Subject: [PATCH] Add messageId to richObject in ReferenceProvider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .../Reference/TalkReferenceProvider.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Collaboration/Reference/TalkReferenceProvider.php b/lib/Collaboration/Reference/TalkReferenceProvider.php index fcb3ad675dc..e6ac2ada630 100644 --- a/lib/Collaboration/Reference/TalkReferenceProvider.php +++ b/lib/Collaboration/Reference/TalkReferenceProvider.php @@ -177,6 +177,7 @@ protected function fetchReference(Reference $reference): void { $roomName = $room->getDisplayName($this->userId); $title = $roomName; $description = ''; + $messageId = null; if ($participant instanceof Participant || $this->roomManager->isRoomListableByUser($room, $this->userId)) { @@ -190,7 +191,8 @@ protected function fetchReference(Reference $reference): void { * Description is the plain text chat message */ if ($participant && !empty($referenceMatch['message'])) { - $comment = $this->chatManager->getComment($room, (string) $referenceMatch['message']); + $messageId = (string) $referenceMatch['message']; + $comment = $this->chatManager->getComment($room, $messageId); $message = $this->messageParser->createMessage($room, $participant, $comment, $this->l); $this->messageParser->parseMessage($message); @@ -233,12 +235,18 @@ protected function fetchReference(Reference $reference): void { $reference->setUrl($this->urlGenerator->linkToRouteAbsolute('spreed.Page.showCall', ['token' => $room->getToken()])); $reference->setImageUrl($this->avatarService->getAvatarUrl($room)); - $reference->setRichObject('call', [ + $referenceData = [ 'id' => $room->getToken(), 'name' => $roomName, 'link' => $reference->getUrl(), 'call-type' => $this->getRoomType($room), - ]); + ]; + + if ($messageId) { + $referenceData['message-id'] = $messageId; + } + + $reference->setRichObject('call', $referenceData); } /**