More peeking of group calls to prevent out-of-date member info

This commit is contained in:
Scott Nonnenberg 2022-03-31 18:06:56 -07:00 committed by GitHub
parent bb250d4fb5
commit 85989fda3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 2 deletions

View file

@ -372,6 +372,10 @@ const doGroupCallPeek = (
return;
}
log.info(
`doGroupCallPeek/groupv2(${conversation.groupId}): Found ${peekInfo.deviceCount} devices`
);
await calling.updateCallHistoryForGroupCall(conversationId, peekInfo);
const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(peekInfo);
@ -988,6 +992,23 @@ function peekGroupCallForTheFirstTime(
};
}
function peekGroupCallIfItHasMembers(
conversationId: string
): ThunkAction<void, RootStateType, unknown, PeekGroupCallFulfilledActionType> {
return (dispatch, getState) => {
const call = getOwn(getState().calling.callsByConversation, conversationId);
const shouldPeek =
call &&
call.callMode === CallMode.Group &&
call.joinState === GroupCallJoinState.NotJoined &&
call.peekInfo &&
call.peekInfo.deviceCount > 0;
if (shouldPeek) {
doGroupCallPeek(conversationId, dispatch, getState);
}
};
}
function peekNotConnectedGroupCall(
payload: PeekNotConnectedGroupCallType
): ThunkAction<void, RootStateType, unknown, PeekGroupCallFulfilledActionType> {
@ -1310,6 +1331,7 @@ export const actions = {
openSystemPreferencesAction,
outgoingCall,
peekGroupCallForTheFirstTime,
peekGroupCallIfItHasMembers,
peekNotConnectedGroupCall,
receiveIncomingDirectCall,
receiveIncomingGroupCall,