Prevent deletion of active call links and style join button

This commit is contained in:
ayumi-signal 2024-09-09 15:09:57 -07:00 committed by GitHub
parent 5835e9033d
commit dec06209e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 198 additions and 65 deletions

View file

@ -5,12 +5,17 @@ import { useSelector } from 'react-redux';
import type { CallHistoryGroup } from '../../types/CallDisposition';
import { getIntl } from '../selectors/user';
import { CallLinkDetails } from '../../components/CallLinkDetails';
import { getActiveCallState, getCallLinkSelector } from '../selectors/calling';
import {
getActiveCallState,
getAdhocCallSelector,
getCallLinkSelector,
} from '../selectors/calling';
import { useGlobalModalActions } from '../ducks/globalModals';
import { useCallingActions } from '../ducks/calling';
import * as log from '../../logging/log';
import { strictAssert } from '../../util/assert';
import type { CallLinkRestrictions } from '../../types/CallLink';
import { isAnybodyInGroupCall } from '../ducks/callingHelpers';
export type SmartCallLinkDetailsProps = Readonly<{
roomId: string;
@ -60,9 +65,16 @@ export const SmartCallLinkDetails = memo(function SmartCallLinkDetails({
[roomId, updateCallLinkRestrictions]
);
const adhocCallSelector = useSelector(getAdhocCallSelector);
const adhocCall = adhocCallSelector(roomId);
const hasActiveCall = isAnybodyInGroupCall(adhocCall?.peekInfo);
const activeCall = useSelector(getActiveCallState);
const hasActiveCall = Boolean(
activeCall && callLink && activeCall?.conversationId !== callLink?.roomId
const isInAnotherCall = Boolean(
activeCall && callLink && activeCall.conversationId !== callLink.roomId
);
const isInCall = Boolean(
activeCall && callLink && activeCall.conversationId === callLink.roomId
);
if (callLink == null) {
@ -74,7 +86,9 @@ export const SmartCallLinkDetails = memo(function SmartCallLinkDetails({
<CallLinkDetails
callHistoryGroup={callHistoryGroup}
callLink={callLink}
hasActiveCall={hasActiveCall}
isAnybodyInCall={hasActiveCall}
isInCall={isInCall}
isInAnotherCall={isInAnotherCall}
i18n={i18n}
onDeleteCallLink={handleDeleteCallLink}
onOpenCallLinkAddNameModal={handleOpenCallLinkAddNameModal}