Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix avatars in federated calls #12863

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions lib/Controller/SignalingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ protected function getUsersInRoom(Room $room, int $pingTimestamp): array {
'sessionId' => $session->getSessionId(),
'inCall' => $session->getInCall(),
'participantPermissions' => $participant->getPermissions(),
'actorType' => $participant->getAttendee()->getActorType(),
'actorId' => $participant->getAttendee()->getActorId(),
];
}

Expand Down
2 changes: 2 additions & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@
* }
*
* @psalm-type TalkSignalingSession = array{
* actorId: string,
* actorType: string,
* inCall: int,
* lastPing: int,
* participantPermissions: int,
Expand Down
10 changes: 6 additions & 4 deletions lib/Signaling/BackendNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ public function participantsModified(Room $room, array $sessionIds): void {
'participantType' => $attendee->getParticipantType(),
'participantPermissions' => Attendee::PERMISSIONS_CUSTOM,
'displayName' => $attendee->getDisplayName(),
'actorType' => $attendee->getActorType(),
'actorId' => $attendee->getActorId(),
];
if ($attendee->getActorType() === Attendee::ACTOR_USERS
|| $attendee->getActorType() === Attendee::ACTOR_FEDERATED_USERS) {
if ($attendee->getActorType() === Attendee::ACTOR_USERS) {
$data['userId'] = $attendee->getActorId();
}

Expand Down Expand Up @@ -428,9 +429,10 @@ public function roomInCallChanged(Room $room, int $flags, array $sessionIds, boo
'nextcloudSessionId' => $session->getSessionId(),
'participantType' => $attendee->getParticipantType(),
'participantPermissions' => $participant->getPermissions(),
'actorType' => $attendee->getActorType(),
'actorId' => $attendee->getActorId(),
];
if ($attendee->getActorType() === Attendee::ACTOR_USERS
|| $attendee->getActorType() === Attendee::ACTOR_FEDERATED_USERS) {
if ($attendee->getActorType() === Attendee::ACTOR_USERS) {
$data['userId'] = $attendee->getActorId();
}

Expand Down
8 changes: 8 additions & 0 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,8 @@
"SignalingSession": {
"type": "object",
"required": [
"actorId",
"actorType",
"inCall",
"lastPing",
"participantPermissions",
Expand All @@ -1352,6 +1354,12 @@
"userId"
],
"properties": {
"actorId": {
"type": "string"
},
"actorType": {
"type": "string"
},
"inCall": {
"type": "integer",
"format": "int64"
Expand Down
8 changes: 8 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,8 @@
"SignalingSession": {
"type": "object",
"required": [
"actorId",
"actorType",
"inCall",
"lastPing",
"participantPermissions",
Expand All @@ -1239,6 +1241,12 @@
"userId"
],
"properties": {
"actorId": {
"type": "string"
},
"actorType": {
"type": "string"
},
"inCall": {
"type": "integer",
"format": "int64"
Expand Down
8 changes: 7 additions & 1 deletion src/components/CallView/shared/VideoVue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ export default {
},

participantActorType() {
if (this.participant?.actorType) {
if (this.model.attributes.actorType) {
return this.model.attributes.actorType
} else if (this.participant?.actorType) {
return this.participant.actorType
} else if (this.peerData?.actorType) {
return this.peerData.actorType
Expand All @@ -370,6 +372,10 @@ export default {
},

participantUserId() {
if (this.model.attributes.actorId) {
return this.model.attributes.actorId
}

if (this.model.attributes.userId) {
return this.model.attributes.userId
}
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2168,6 +2168,8 @@
};
RoomLastMessage: components["schemas"]["ChatMessage"] | components["schemas"]["ChatProxyMessage"];
SignalingSession: {
actorId: string;
actorType: string;
/** Format: int64 */
inCall: number;
/** Format: int64 */
Expand Down Expand Up @@ -2708,7 +2710,7 @@
/**
* Format: int64
* @description Mode of the breakout rooms
* @enum {integer}

Check warning on line 2713 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
mode: 0 | 1 | 2 | 3;
/**
Expand Down Expand Up @@ -3773,7 +3775,7 @@
/**
* Format: int64
* @description Polling for new messages (1) or getting the history of the chat (0)
* @enum {integer}

Check warning on line 3778 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
lookIntoFuture: 0 | 1;
/**
Expand Down Expand Up @@ -3807,28 +3809,28 @@
* @description Automatically set the last read marker when 1,
* if your client does this itself via chat/{token}/read set to 0
* @default 1
* @enum {integer}

Check warning on line 3812 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
setReadMarker?: 0 | 1;
/**
* Format: int64
* @description Include the $lastKnownMessageId in the messages when 1 (default 0)
* @default 0
* @enum {integer}

Check warning on line 3819 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
includeLastKnown?: 0 | 1;
/**
* Format: int64
* @description When the user status should not be automatically set to online set to 1 (default 0)
* @default 0
* @enum {integer}

Check warning on line 3826 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
noStatusUpdate?: 0 | 1;
/**
* Format: int64
* @description Set to 0 when notifications should not be marked as read (default 1)
* @default 1
* @enum {integer}

Check warning on line 3833 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
markNotificationsAsRead?: 0 | 1;
};
Expand Down Expand Up @@ -5181,7 +5183,7 @@
/**
* Format: int64
* @description Mode how the results will be shown
* @enum {integer}

Check warning on line 5186 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
resultMode: 0 | 1;
/**
Expand Down Expand Up @@ -5938,7 +5940,7 @@
* Format: int64
* @description When the user status should not be automatically set to online set to 1 (default 0)
* @default 0
* @enum {integer}

Check warning on line 5943 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
noStatusUpdate?: 0 | 1;
/**
Expand Down Expand Up @@ -6438,7 +6440,7 @@
/**
* Format: int64
* @description New read-only state
* @enum {integer}

Check warning on line 6443 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
state: 0 | 1;
};
Expand Down Expand Up @@ -6494,7 +6496,7 @@
/**
* Format: int64
* @description Scope where the room is listable
* @enum {integer}

Check warning on line 6499 in src/types/openapi/openapi-full.ts

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'integer' is undefined
*/
scope: 0 | 1 | 2;
};
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,8 @@ export type components = {
};
RoomLastMessage: components["schemas"]["ChatMessage"] | components["schemas"]["ChatProxyMessage"];
SignalingSession: {
actorId: string;
actorType: string;
/** Format: int64 */
inCall: number;
/** Format: int64 */
Expand Down
7 changes: 7 additions & 0 deletions src/utils/webrtc/models/CallParticipantModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default function CallParticipantModel(options) {
screenPeer: null,
// "undefined" is used for values not known yet; "null" or "false"
// are used for known but negative/empty values.
actorType: undefined,
actorId: undefined,
userId: undefined,
name: undefined,
internal: undefined,
Expand Down Expand Up @@ -349,6 +351,11 @@ CallParticipantModel.prototype = {
}
},

setActor(actorType, actorId) {
this.set('actorType', actorType)
this.set('actorId', actorId)
},

setUserId(userId) {
this.set('userId', userId)
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/webrtc/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
webRtc: webrtc,
})
}
callParticipantModel.setActor(user.actorType, user.actorId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

desktop client goes 💥 when speaking to a 19 server?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attributes would be simply undefined, which would not change the previous behaviour nor break anything, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, no PHP style Undefined key X error. fine by me then

callParticipantModel.setUserId(userId)
callParticipantModel.setNextcloudSessionId(nextcloudSessionId)
if (user.internal) {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/callapi/update-call-flags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Feature: callapi/update-call-flags
Then signaling server received the following requests
| token | data |
| public room | {"type":"message","message":{"data":{"type":"chat","chat":{"refresh":true}}}} |
| public room | {"type":"incall","incall":{"incall":7,"changed":[{"inCall":7,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"userId":"owner"}],"users":[{"inCall":7,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"userId":"owner"}]}} |
| public room | {"type":"incall","incall":{"incall":7,"changed":[{"inCall":7,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"actorType":"users","actorId":"owner","userId":"owner"}],"users":[{"inCall":7,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"actorType":"users","actorId":"owner","userId":"owner"}]}} |
And reset signaling server requests
When user "owner" updates call flags in room "public room" to "1" with 200 (v4)
Then signaling server received the following requests
| token | data |
| public room | {"type":"incall","incall":{"incall":1,"changed":[{"inCall":1,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"userId":"owner"}],"users":[{"inCall":1,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"userId":"owner"}]}} |
| public room | {"type":"incall","incall":{"incall":1,"changed":[{"inCall":1,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"actorType":"users","actorId":"owner","userId":"owner"}],"users":[{"inCall":1,"lastPing":LAST_PING(),"sessionId":"SESSION(owner)","nextcloudSessionId":"SESSION(owner)","participantType":1,"participantPermissions":254,"actorType":"users","actorId":"owner","userId":"owner"}]}} |
And user "moderator" joins call "public room" with 200 (v4)
And user "invited user" joins call "public room" with 200 (v4)
And user "not invited but joined user" joins call "public room" with 200 (v4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Feature: conversation-2/promotion-demotion
# "participantsModified" once the clients no longer expect a
# "roomModified" message for participant type changes.
| room | {"type":"update","update":{"userids":["participant1","participant2"],"properties":{"name":"Private conversation","type":3,"lobby-state":0,"lobby-timer":null,"read-only":0,"listable":0,"active-since":null,"sip-enabled":0,"description":""}}} |
| room | {"type":"participants","participants":{"changed":[],"users":[{"inCall":0,"lastPing":0,"sessionId":"0","participantType":1,"participantPermissions":1,"displayName":"participant1-displayname","userId":"participant1"},{"inCall":0,"lastPing":0,"sessionId":"0","participantType":2,"participantPermissions":1,"displayName":"participant2-displayname","userId":"participant2"}]}} |
| room | {"type":"participants","participants":{"changed":[],"users":[{"inCall":0,"lastPing":0,"sessionId":"0","participantType":1,"participantPermissions":1,"displayName":"participant1-displayname","actorType":"users","actorId":"participant1","userId":"participant1"},{"inCall":0,"lastPing":0,"sessionId":"0","participantType":2,"participantPermissions":1,"displayName":"participant2-displayname","actorType":"users","actorId":"participant2","userId":"participant2"}]}} |
And user "participant2" is participant of the following rooms (v4)
| id | type | participantType |
| room | 3 | 2 |
Expand Down
Loading