Skip to content

Commit

Permalink
Merge pull request #12863 from nextcloud/fix-avatars-in-federated-calls
Browse files Browse the repository at this point in the history
Fix avatars in federated calls
  • Loading branch information
nickvergessen authored Aug 1, 2024
2 parents 4e97e39 + 0264d3d commit ee0f880
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 8 deletions.
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 @@ export type components = {
};
RoomLastMessage: components["schemas"]["ChatMessage"] | components["schemas"]["ChatProxyMessage"];
SignalingSession: {
actorId: string;
actorType: string;
/** Format: int64 */
inCall: number;
/** Format: int64 */
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)
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

0 comments on commit ee0f880

Please sign in to comment.