Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Notify "roomlist" updates to federated users
When a participant is invited or disinvited to a conversation, or a
session is removed, the affected user receives a "roomlist" message with
type "invite" or "disinvite", while the rest of users in the
conversation receive a "roomlist" message with type "update" and a
"participant-list: refresh" property. Now both federated users and local
users receive the "roomlist" update.

Local users are also notified with a "roomlist" update when the
properties of the room change. However, in that case the signaling
server of federated users will be notified by the federated Nextcloud
server when the property changes are propagated to it, so there is no
need to notify federated users from the remote Nextcloud server in that
case.

Note, however, that independently of the users explicitly notified with
the "userids" parameter (which can include inactive participants) that
receive the "roomlist" message, the signaling server automatically
notifies all active participants in a conversation when it is modified,
so active federated users will receive a "room" message with the updated
properties (which may never be reflected in the proxy conversation, as
some properties are not propagated to the federated conversations).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu authored and nickvergessen committed Jul 24, 2024
commit 705633861094c66572678fd914239b28a1ca5b64
7 changes: 7 additions & 0 deletions lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,13 @@ public function getParticipantUserIds(Room $room, ?\DateTime $maxLastJoined = nu
return $this->getParticipantActorIdsByActorType($room, [Attendee::ACTOR_USERS], $maxLastJoined);
}

/**
* @return string[]
*/
public function getParticipantUserIdsAndFederatedUserCloudIds(Room $room, ?\DateTime $maxLastJoined = null): array {
return $this->getParticipantActorIdsByActorType($room, [Attendee::ACTOR_USERS, Attendee::ACTOR_FEDERATED_USERS], $maxLastJoined);
}

/**
* @return string[]
*/
Expand Down
9 changes: 6 additions & 3 deletions lib/Signaling/BackendNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function roomInvited(Room $room, array $attendees): void {
'userids' => $userIds,
// TODO(fancycode): We should try to get rid of 'alluserids' and
// find a better way to notify existing users to update the room.
'alluserids' => $this->participantService->getParticipantUserIds($room),
'alluserids' => $this->participantService->getParticipantUserIdsAndFederatedUserCloudIds($room),
'properties' => $room->getPropertiesForSignaling('', false),
],
]);
Expand All @@ -176,7 +176,7 @@ public function roomInvited(Room $room, array $attendees): void {
* @throws \Exception
*/
public function roomsDisinvited(Room $room, array $attendees): void {
$allUserIds = $this->participantService->getParticipantUserIds($room);
$allUserIds = $this->participantService->getParticipantUserIdsAndFederatedUserCloudIds($room);
sort($allUserIds);
$userIds = [];
foreach ($attendees as $attendee) {
Expand Down Expand Up @@ -212,7 +212,7 @@ public function roomsDisinvited(Room $room, array $attendees): void {
* @throws \Exception
*/
public function roomSessionsRemoved(Room $room, array $sessionIds): void {
$allUserIds = $this->participantService->getParticipantUserIds($room);
$allUserIds = $this->participantService->getParticipantUserIdsAndFederatedUserCloudIds($room);
sort($allUserIds);
$start = microtime(true);
$this->backendRequest($room, [
Expand Down Expand Up @@ -245,6 +245,9 @@ public function roomModified(Room $room): void {
$this->backendRequest($room, [
'type' => 'update',
'update' => [
// Message not sent for federated users, as they will receive
// the message from their federated Nextcloud server once the
// property change is propagated.
'userids' => $this->participantService->getParticipantUserIds($room),
'properties' => $room->getPropertiesForSignaling(''),
],
Expand Down