Fix adding group call history with no ring

This commit is contained in:
Jamie Kyle 2023-08-23 10:07:29 -07:00 committed by GitHub
parent da05b32f4f
commit d3a18a197b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View file

@ -2261,7 +2261,7 @@ export class CallingClass {
public async updateCallHistoryForGroupCall(
conversationId: string,
joinState: GroupCallJoinState,
joinState: GroupCallJoinState | null,
peekInfo: PeekInfo | null
): Promise<void> {
const groupCallMeta = getGroupCallMeta(peekInfo);

View file

@ -372,13 +372,14 @@ const doGroupCallPeek = (
`doGroupCallPeek/groupv2(${conversation.groupId}): Found ${peekInfo.deviceCount} devices`
);
if (existingCall?.callMode === CallMode.Group) {
await calling.updateCallHistoryForGroupCall(
conversationId,
existingCall.joinState,
peekInfo
);
}
const joinState =
existingCall?.callMode === CallMode.Group ? existingCall.joinState : null;
await calling.updateCallHistoryForGroupCall(
conversationId,
joinState,
peekInfo
);
const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(peekInfo);

View file

@ -352,20 +352,20 @@ export function getLocalCallEventFromRingUpdate(
}
export function getLocalCallEventFromJoinState(
joinState: GroupCallJoinState,
joinState: GroupCallJoinState | null,
groupCallMeta: GroupCallMeta
): LocalCallEvent | null {
const direction = getCallDirectionFromRingerId(groupCallMeta.ringerId);
log.info(
'getLocalCallEventFromGroupCall',
direction,
GroupCallJoinState[joinState]
joinState != null ? GroupCallJoinState[joinState] : null
);
if (direction === CallDirection.Incoming) {
if (joinState === GroupCallJoinState.Joined) {
return LocalCallEvent.Accepted;
}
if (joinState === GroupCallJoinState.NotJoined) {
if (joinState === GroupCallJoinState.NotJoined || joinState == null) {
return LocalCallEvent.Started;
}
if (
@ -376,7 +376,7 @@ export function getLocalCallEventFromJoinState(
}
throw missingCaseError(joinState);
} else {
if (joinState === GroupCallJoinState.NotJoined) {
if (joinState === GroupCallJoinState.NotJoined || joinState == null) {
return LocalCallEvent.Started;
}
return LocalCallEvent.Ringing;