Fix doGroupCallPeek to skip direct conversations
This commit is contained in:
parent
73c0e0eb18
commit
8a21f8655f
1 changed files with 30 additions and 13 deletions
|
@ -54,7 +54,7 @@ import type {
|
||||||
ConversationChangedActionType,
|
ConversationChangedActionType,
|
||||||
ConversationRemovedActionType,
|
ConversationRemovedActionType,
|
||||||
} from './conversations';
|
} from './conversations';
|
||||||
import { updateLastMessage } from './conversations';
|
import { getConversationCallMode, updateLastMessage } from './conversations';
|
||||||
import * as log from '../../logging/log';
|
import * as log from '../../logging/log';
|
||||||
import { strictAssert } from '../../util/assert';
|
import { strictAssert } from '../../util/assert';
|
||||||
import { waitForOnline } from '../../util/waitForOnline';
|
import { waitForOnline } from '../../util/waitForOnline';
|
||||||
|
@ -75,6 +75,7 @@ import {
|
||||||
import type { ShowErrorModalActionType } from './globalModals';
|
import type { ShowErrorModalActionType } from './globalModals';
|
||||||
import { SHOW_ERROR_MODAL } from './globalModals';
|
import { SHOW_ERROR_MODAL } from './globalModals';
|
||||||
import { ButtonVariant } from '../../components/Button';
|
import { ButtonVariant } from '../../components/Button';
|
||||||
|
import { getConversationIdForLogging } from '../../util/idForLogging';
|
||||||
|
|
||||||
// State
|
// State
|
||||||
|
|
||||||
|
@ -420,12 +421,26 @@ const doGroupCallPeek = ({
|
||||||
>;
|
>;
|
||||||
getState: () => RootStateType;
|
getState: () => RootStateType;
|
||||||
}) => {
|
}) => {
|
||||||
const conversation = getOwn(
|
let logId: string;
|
||||||
getState().conversations.conversationLookup,
|
if (callMode === CallMode.Group) {
|
||||||
conversationId
|
const conversation = getOwn(
|
||||||
);
|
getState().conversations.conversationLookup,
|
||||||
if (!conversation || !isGroupOrAdhocCallMode(callMode)) {
|
conversationId
|
||||||
return;
|
);
|
||||||
|
if (
|
||||||
|
!conversation ||
|
||||||
|
getConversationCallMode(conversation) !== CallMode.Group
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logId = getConversationIdForLogging(conversation);
|
||||||
|
} else {
|
||||||
|
const callLink = getOwn(getState().calling.callLinks, conversationId);
|
||||||
|
if (!callLink) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logId = `adhoc(${conversationId})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let queue = peekQueueByConversation.get(conversationId);
|
let queue = peekQueueByConversation.get(conversationId);
|
||||||
|
@ -469,6 +484,7 @@ const doGroupCallPeek = ({
|
||||||
if (callMode === CallMode.Group) {
|
if (callMode === CallMode.Group) {
|
||||||
peekInfo = await calling.peekGroupCall(conversationId);
|
peekInfo = await calling.peekGroupCall(conversationId);
|
||||||
} else {
|
} else {
|
||||||
|
// For adhoc calls, conversationId is actually a roomId.
|
||||||
const rootKey: string | undefined = getOwn(
|
const rootKey: string | undefined = getOwn(
|
||||||
state.calling.callLinks,
|
state.calling.callLinks,
|
||||||
conversationId
|
conversationId
|
||||||
|
@ -484,9 +500,7 @@ const doGroupCallPeek = ({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(
|
log.info(`doGroupCallPeek/${logId}: Found ${peekInfo.deviceCount} devices`);
|
||||||
`doGroupCallPeek/groupv2(${conversation.groupId}): Found ${peekInfo.deviceCount} devices`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (callMode === CallMode.Group) {
|
if (callMode === CallMode.Group) {
|
||||||
const joinState = isGroupOrAdhocCallState(existingCall)
|
const joinState = isGroupOrAdhocCallState(existingCall)
|
||||||
|
@ -505,6 +519,8 @@ const doGroupCallPeek = ({
|
||||||
Errors.toLogFormat(error)
|
Errors.toLogFormat(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch(updateLastMessage(conversationId));
|
||||||
}
|
}
|
||||||
|
|
||||||
const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(peekInfo);
|
const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(peekInfo);
|
||||||
|
@ -517,8 +533,6 @@ const doGroupCallPeek = ({
|
||||||
peekInfo: formattedPeekInfo,
|
peekInfo: formattedPeekInfo,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(updateLastMessage(conversationId));
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2611,13 +2625,16 @@ export function reducer(
|
||||||
|
|
||||||
if (action.type === PEEK_GROUP_CALL_FULFILLED) {
|
if (action.type === PEEK_GROUP_CALL_FULFILLED) {
|
||||||
const { callMode, conversationId, peekInfo } = action.payload;
|
const { callMode, conversationId, peekInfo } = action.payload;
|
||||||
|
if (!isGroupOrAdhocCallMode(callMode)) {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
const existingCall: GroupCallStateType = getGroupCall(
|
const existingCall: GroupCallStateType = getGroupCall(
|
||||||
conversationId,
|
conversationId,
|
||||||
state,
|
state,
|
||||||
callMode
|
callMode
|
||||||
) || {
|
) || {
|
||||||
callMode: CallMode.Group,
|
callMode,
|
||||||
conversationId,
|
conversationId,
|
||||||
connectionState: GroupCallConnectionState.NotConnected,
|
connectionState: GroupCallConnectionState.NotConnected,
|
||||||
joinState: GroupCallJoinState.NotJoined,
|
joinState: GroupCallJoinState.NotJoined,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue