Fix pre call info for call links with admin approval

This commit is contained in:
ayumi-signal 2024-11-14 12:43:02 -08:00 committed by GitHub
parent b7d67b453a
commit ec3c46d356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 143 additions and 45 deletions

View file

@ -9,6 +9,11 @@ import enMessages from '../../_locales/en/messages.json';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import type { PropsType } from './CallingPreCallInfo';
import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo';
import type { ConversationType } from '../state/ducks/conversations';
import { getPlaceholderContact } from '../state/selectors/conversations';
import { generateAci } from '../types/ServiceId';
import { FAKE_CALL_LINK } from '../test-both/helpers/fakeCallLink';
import { callLinkToConversation } from '../util/callLinks';
const i18n = setupI18n('en', enMessages);
const getDefaultGroupConversation = () =>
@ -21,6 +26,11 @@ const getDefaultGroupConversation = () =>
});
const otherMembers = times(6, () => getDefaultConversation());
const getUnknownContact = (): ConversationType => ({
...getPlaceholderContact(),
serviceId: generateAci(),
});
export default {
title: 'Components/CallingPreCallInfo',
} satisfies Meta<PropsType>;
@ -245,3 +255,63 @@ export function GroupConversationCallIsFull(): JSX.Element {
/>
);
}
export function CallLinkUnknownContact(): JSX.Element {
return (
<CallingPreCallInfo
conversation={callLinkToConversation(FAKE_CALL_LINK, i18n)}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[getUnknownContact()]}
ringMode={RingMode.WillNotRing}
/>
);
}
export function CallLink3UnknownContacts(): JSX.Element {
return (
<CallingPreCallInfo
conversation={callLinkToConversation(FAKE_CALL_LINK, i18n)}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[
getUnknownContact(),
getUnknownContact(),
getUnknownContact(),
]}
ringMode={RingMode.WillNotRing}
/>
);
}
export function CallLink1Known1UnknownContact(): JSX.Element {
return (
<CallingPreCallInfo
conversation={callLinkToConversation(FAKE_CALL_LINK, i18n)}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[otherMembers[0], getUnknownContact()]}
ringMode={RingMode.WillNotRing}
/>
);
}
export function CallLink1Known2UnknownContacts(): JSX.Element {
return (
<CallingPreCallInfo
conversation={callLinkToConversation(FAKE_CALL_LINK, i18n)}
groupMembers={otherMembers}
i18n={i18n}
me={getDefaultConversation()}
peekedParticipants={[
otherMembers[0],
getUnknownContact(),
getUnknownContact(),
]}
ringMode={RingMode.WillNotRing}
/>
);
}