diff --git a/lib/Federation/Proxy/TalkV1/Controller/CallController.php b/lib/Federation/Proxy/TalkV1/Controller/CallController.php index 916666bd4eb..73920f32242 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 @@ -105,7 +105,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, array{}>|DataResponse @@ -135,7 +135,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 @@ -172,7 +172,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/Federation/Proxy/TalkV1/ProxyRequest.php b/lib/Federation/Proxy/TalkV1/ProxyRequest.php index ea5d606bc2f..55ce4642c05 100644 --- a/lib/Federation/Proxy/TalkV1/ProxyRequest.php +++ b/lib/Federation/Proxy/TalkV1/ProxyRequest.php @@ -123,6 +123,7 @@ protected function request( try { $body = $e->getResponse()->getBody()->getContents(); $data = json_decode($body, true, flags: JSON_THROW_ON_ERROR); + $e->getResponse()->getBody()->rewind(); if (!is_array($data)) { throw new \RuntimeException('JSON response is not an array'); } 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 diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index a813e906596..bba48b4a67d 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -291,7 +291,7 @@ public function setSIPEnabled(Room $room, int $newSipEnabled): void { * @psalm-param RecordingService::CONSENT_REQUIRED_* $recordingConsent * @throws RecordingConsentException When the room has an active call or the value is invalid */ - public function setRecordingConsent(Room $room, int $recordingConsent, bool $allowUpdatingBreakoutRooms = false): void { + public function setRecordingConsent(Room $room, int $recordingConsent, bool $allowUpdatingBreakoutRoomsAndFederatedRooms = false): void { $oldRecordingConsent = $room->getRecordingConsent(); if ($recordingConsent === $oldRecordingConsent) { @@ -302,16 +302,18 @@ public function setRecordingConsent(Room $room, int $recordingConsent, bool $all throw new RecordingConsentException(RecordingConsentException::REASON_VALUE); } - if ($recordingConsent !== RecordingService::CONSENT_REQUIRED_NO && $room->getCallFlag() !== Participant::FLAG_DISCONNECTED) { - throw new RecordingConsentException(RecordingConsentException::REASON_CALL); - } + if (!$allowUpdatingBreakoutRoomsAndFederatedRooms) { + if ($recordingConsent !== RecordingService::CONSENT_REQUIRED_NO && $room->getCallFlag() !== Participant::FLAG_DISCONNECTED) { + throw new RecordingConsentException(RecordingConsentException::REASON_CALL); + } - if (!$allowUpdatingBreakoutRooms && $room->getObjectType() === BreakoutRoom::PARENT_OBJECT_TYPE) { - throw new RecordingConsentException(RecordingConsentException::REASON_BREAKOUT_ROOM); - } + if ($room->getObjectType() === BreakoutRoom::PARENT_OBJECT_TYPE) { + throw new RecordingConsentException(RecordingConsentException::REASON_BREAKOUT_ROOM); + } - if ($room->getBreakoutRoomStatus() !== BreakoutRoom::STATUS_STOPPED) { - throw new RecordingConsentException(RecordingConsentException::REASON_BREAKOUT_ROOM); + if ($room->getBreakoutRoomStatus() !== BreakoutRoom::STATUS_STOPPED) { + throw new RecordingConsentException(RecordingConsentException::REASON_BREAKOUT_ROOM); + } } $event = new BeforeRoomModifiedEvent($room, ARoomModifiedEvent::PROPERTY_RECORDING_CONSENT, $recordingConsent, $oldRecordingConsent);