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 Dec 4, 2024
1 parent ce47d8f commit dd05ef6
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 @@ -758,8 +758,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 @@ -782,7 +786,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 dd05ef6

Please sign in to comment.