Skip to content

Commit

Permalink
fix(room): Fix undefined variable in federated calls
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Nov 21, 2024
1 parent 7d9f7e3 commit 90b6a0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Federation/Proxy/TalkV1/Controller/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<Http::STATUS_OK|Http::STATUS_NOT_FOUND, null, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: string}, array{}>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/Federation/Proxy/TalkV1/Controller/ReactionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions lib/Service/RoomFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -396,6 +397,7 @@ public function formatRoomV4(
} catch (DoesNotExistException) {
}
}

if ($currentUser instanceof IUser
&& $attendee->getActorType() === Attendee::ACTOR_USERS
&& $roomData['lastReadMessage'] === ChatManager::UNREAD_FIRST_MESSAGE
Expand Down

0 comments on commit 90b6a0c

Please sign in to comment.