Skip to content

Commit

Permalink
Fix group call outgoing ring
Browse files Browse the repository at this point in the history
Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and ayumi-signal committed Mar 1, 2024
1 parent 6eda58b commit 09aea38
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
25 changes: 17 additions & 8 deletions ts/state/ducks/calling.ts
Expand Up @@ -2137,14 +2137,23 @@ export function reducer(
remoteParticipants,
...ringState,
};
newAdhocCalls =
callMode === CallMode.Adhoc
? {
...adhocCalls,
[conversationId]: call,
}
: adhocCalls;
outgoingRing = false;

if (callMode === CallMode.Group) {
outgoingRing =
!ringState.ringId &&
!call.peekInfo?.acis.length &&
!call.remoteParticipants.length &&
!action.payload.isConversationTooBigToRing;
newAdhocCalls = adhocCalls;
} else if (callMode === CallMode.Adhoc) {
outgoingRing = false;
newAdhocCalls = {
...adhocCalls,
[conversationId]: call,
};
} else {
throw missingCaseError(action.payload);
}
break;
}
default:
Expand Down
14 changes: 14 additions & 0 deletions ts/test-electron/state/ducks/calling_test.ts
Expand Up @@ -2102,6 +2102,20 @@ describe('calling duck', () => {
assert.strictEqual(call.ringId, BigInt(987));
assert.strictEqual(call.ringerAci, ringerAci);
});

it('enables outgoingRing for a group call when there is no existing call', async () => {
const result = await getState(getEmptyState(), {
callMode: CallMode.Group,
hasLocalAudio: true,
hasLocalVideo: true,
connectionState: GroupCallConnectionState.Connected,
joinState: GroupCallJoinState.NotJoined,
peekInfo: undefined,
remoteParticipants: [],
});

assert.isTrue(result.activeCallState?.outgoingRing);
});
});
});

Expand Down

0 comments on commit 09aea38

Please sign in to comment.