Skip to content

Commit

Permalink
fix: Avoid remote mute transmitting to other calls (#18423)
Browse files Browse the repository at this point in the history
* fix: Avoid remote mute message transmitting to other calls

* fix tests

* fix tests
  • Loading branch information
thisisamir98 authored and V-Gira committed Dec 9, 2024
1 parent 41d249f commit bd93f9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/script/calling/CallingRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ describe('CallingRepository', () => {
buildMediaDevicesHandler(),
);

call.state(CALL_STATE.MEDIA_ESTAB);

conversation.roles({[senderUserId.id]: DefaultConversationRoleName.WIRE_ADMIN});

callingRepository['conversationState'].conversations.push(conversation);
spyOn(callingRepository, 'findCall').and.returnValue(call);
callingRepository['callState'].calls([call]);
spyOn(callingRepository, 'muteCall').and.callThrough();
spyOn(wCall, 'recvMsg').and.callThrough();

Expand Down Expand Up @@ -175,10 +177,12 @@ describe('CallingRepository', () => {
buildMediaDevicesHandler(),
);

call.state(CALL_STATE.MEDIA_ESTAB);

conversation.roles({[senderUserId.id]: DefaultConversationRoleName.WIRE_MEMBER});

callingRepository['conversationState'].conversations.push(conversation);
spyOn(callingRepository, 'findCall').and.returnValue(call);
callingRepository['callState'].calls([call]);
spyOn(callingRepository, 'muteCall').and.callThrough();
spyOn(wCall, 'recvMsg').and.callThrough();

Expand Down Expand Up @@ -218,10 +222,12 @@ describe('CallingRepository', () => {
buildMediaDevicesHandler(),
);

call.state(CALL_STATE.MEDIA_ESTAB);

conversation.roles({[senderUserId.id]: DefaultConversationRoleName.WIRE_ADMIN});

callingRepository['conversationState'].conversations.push(conversation);
spyOn(callingRepository, 'findCall').and.returnValue(call);
callingRepository['callState'].calls([call]);
spyOn(callingRepository, 'muteCall').and.callThrough();
spyOn(wCall, 'recvMsg').and.callThrough();

Expand Down
10 changes: 7 additions & 3 deletions src/script/calling/CallingRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,12 @@ export class CallingRepository {
}

case CALL_MESSAGE_TYPE.REMOTE_MUTE: {
const call = this.findCall(conversationId);
if (!call) {
const currentCall = this.callState.joinedCall();
if (
!currentCall ||
!matchQualifiedIds(currentCall.conversation.qualifiedId, conversationId) ||
!this.selfUser
) {
return;
}

Expand All @@ -747,7 +751,7 @@ export class CallingRepository {
return;
}

this.muteCall(call, true, MuteState.REMOTE_MUTED);
this.muteCall(currentCall, true, MuteState.REMOTE_MUTED);
return this.processCallingMessage(conversation, event);
}

Expand Down

0 comments on commit bd93f9d

Please sign in to comment.