From 90b6a0c7031be5f67bcb95633c86f669e0e74650 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 21 Nov 2024 23:08:41 +0100 Subject: [PATCH] fix(room): Fix undefined variable in federated calls Signed-off-by: Joas Schilling --- .../Proxy/TalkV1/Controller/CallController.php | 10 +++++----- .../Proxy/TalkV1/Controller/ReactionController.php | 6 ++++++ lib/Service/RoomFormatter.php | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/Federation/Proxy/TalkV1/Controller/CallController.php b/lib/Federation/Proxy/TalkV1/Controller/CallController.php index a2d6ab265c4..f4c3903f43a 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/CallController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/CallController.php @@ -32,7 +32,7 @@ public function __construct( } /** - * @see \OCA\Talk\Controller\RoomController::getPeersForCall() + * @see \OCA\Talk\Controller\CallController::getPeersForCall() * * @param Room $room the federated room to get the call peers * @param Participant $participant the federated user to get the call peers @@ -64,7 +64,7 @@ public function getPeersForCall(Room $room, Participant $participant): DataRespo } /** - * @see \OCA\Talk\Controller\RoomController::joinFederatedCall() + * @see \OCA\Talk\Controller\CallController::joinFederatedCall() * * @param Room $room the federated room to join the call in * @param Participant $participant the federated user that will join the @@ -111,7 +111,7 @@ public function joinFederatedCall(Room $room, Participant $participant, int $fla } /** - * @see \OCA\Talk\Controller\RoomController::ringAttendee() + * @see \OCA\Talk\Controller\CallController::ringAttendee() * * @param int $attendeeId ID of the attendee to ring * @return DataResponse|DataResponse @@ -144,7 +144,7 @@ public function ringAttendee(Room $room, Participant $participant, int $attendee } /** - * @see \OCA\Talk\Controller\RoomController::updateFederatedCallFlags() + * @see \OCA\Talk\Controller\CallController::updateFederatedCallFlags() * * @param Room $room the federated room to update the call flags in * @param Participant $participant the federated user to update the call @@ -181,7 +181,7 @@ public function updateFederatedCallFlags(Room $room, Participant $participant, i } /** - * @see \OCA\Talk\Controller\RoomController::leaveFederatedCall() + * @see \OCA\Talk\Controller\CallController::leaveFederatedCall() * * @param Room $room the federated room to leave the call in * @param Participant $participant the federated user that will leave the diff --git a/lib/Federation/Proxy/TalkV1/Controller/ReactionController.php b/lib/Federation/Proxy/TalkV1/Controller/ReactionController.php index 234e2ceedfa..2812a7591e1 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/ReactionController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/ReactionController.php @@ -38,6 +38,8 @@ public function __construct( * 201: Reaction added successfully * 400: Adding reaction is not possible * 404: Message not found + * + * @see \OCA\Talk\Controller\ReactionController::react() */ public function react(Room $room, Participant $participant, int $messageId, string $reaction, string $format): DataResponse { $proxy = $this->proxy->post( @@ -78,6 +80,8 @@ public function react(Room $room, Participant $participant, int $messageId, stri * 200: Reaction deleted successfully * 400: Deleting reaction is not possible * 404: Message not found + * + * @see \OCA\Talk\Controller\ReactionController::delete() */ public function delete(Room $room, Participant $participant, int $messageId, string $reaction, string $format): DataResponse { $proxy = $this->proxy->delete( @@ -118,6 +122,8 @@ public function delete(Room $room, Participant $participant, int $messageId, str * * 200: Reactions returned * 404: Message or reaction not found + * + * @see \OCA\Talk\Controller\ReactionController::getReactions() */ public function getReactions(Room $room, Participant $participant, int $messageId, ?string $reaction, string $format): DataResponse { $proxy = $this->proxy->get( diff --git a/lib/Service/RoomFormatter.php b/lib/Service/RoomFormatter.php index d0349d5221a..e9311c2c768 100644 --- a/lib/Service/RoomFormatter.php +++ b/lib/Service/RoomFormatter.php @@ -284,6 +284,7 @@ public function formatRoomV4( $roomData['canStartCall'] = $currentParticipant->canStartCall($this->serverConfig); + $currentUser = null; if ($attendee->getActorType() === Attendee::ACTOR_USERS) { $currentUser = $this->userManager->get($attendee->getActorId()); if ($room->isFederatedConversation()) { @@ -396,6 +397,7 @@ public function formatRoomV4( } catch (DoesNotExistException) { } } + if ($currentUser instanceof IUser && $attendee->getActorType() === Attendee::ACTOR_USERS && $roomData['lastReadMessage'] === ChatManager::UNREAD_FIRST_MESSAGE