Introduce Service Id Types

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2023-08-10 18:43:33 +02:00 committed by Jamie Kyle
parent 414c0a58d3
commit 366b875fd2
269 changed files with 5832 additions and 5550 deletions

View file

@ -5,9 +5,17 @@ import * as React from 'react';
import { action } from '@storybook/addon-actions';
import { generateAci } from '../../types/ServiceId';
import type { Props } from './AtMentionify';
import { AtMentionify } from './AtMentionify';
const SERVICE_ID_1 = generateAci();
const SERVICE_ID_2 = generateAci();
const SERVICE_ID_3 = generateAci();
const SERVICE_ID_4 = generateAci();
const SERVICE_ID_5 = generateAci();
const SERVICE_ID_6 = generateAci();
export default {
title: 'Components/Conversation/AtMentionify',
};
@ -32,21 +40,21 @@ export function MultipleMentions(): JSX.Element {
{
start: 4,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_1,
replacementText: 'Professor Farnsworth',
conversationID: 'x',
},
{
start: 2,
length: 1,
mentionUuid: 'def',
mentionUuid: SERVICE_ID_2,
replacementText: 'Philip J Fry',
conversationID: 'x',
},
{
start: 0,
length: 1,
mentionUuid: 'xyz',
mentionUuid: SERVICE_ID_3,
replacementText: 'Yancy Fry',
conversationID: 'x',
},
@ -65,21 +73,21 @@ export function ComplexMentions(): JSX.Element {
{
start: 80,
length: 1,
mentionUuid: 'ioe',
mentionUuid: SERVICE_ID_4,
replacementText: 'Cereal Killer',
conversationID: 'x',
},
{
start: 78,
length: 1,
mentionUuid: 'fdr',
mentionUuid: SERVICE_ID_5,
replacementText: 'Acid Burn',
conversationID: 'x',
},
{
start: 4,
length: 1,
mentionUuid: 'ope',
mentionUuid: SERVICE_ID_6,
replacementText: 'Zero Cool',
conversationID: 'x',
},
@ -101,7 +109,7 @@ export function WithOddCharacter(): JSX.Element {
{
start: 4,
length: 1,
mentionUuid: 'ope',
mentionUuid: SERVICE_ID_6,
replacementText: 'Zero Cool',
conversationID: 'x',
},

View file

@ -7,6 +7,7 @@ import { action } from '@storybook/addon-actions';
import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import { CallMode } from '../../types/Calling';
import { generateAci } from '../../types/ServiceId';
import { CallingNotification, type PropsType } from './CallingNotification';
import {
getDefaultConversation,
@ -19,7 +20,6 @@ import {
GroupCallStatus,
DirectCallStatus,
} from '../../types/CallDisposition';
import { UUID } from '../../types/UUID';
import type { ConversationType } from '../../state/ducks/conversations';
import { CallExternalState } from '../../util/callingNotification';
@ -45,7 +45,7 @@ const getCommonProps = (options: {
? GroupCallStatus.GenericGroupCall
: DirectCallStatus.Pending,
callCreator = getDefaultConversation({
uuid: UUID.generate().toString(),
uuid: generateAci(),
isMe: direction === CallDirection.Outgoing,
}),
callExternalState = CallExternalState.Active,

View file

@ -5,8 +5,8 @@ import * as React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../../util/setupI18n';
import { UUID } from '../../types/UUID';
import type { UUIDStringType } from '../../types/UUID';
import { generateAci, generatePni } from '../../types/ServiceId';
import type { ServiceIdString, AciString } from '../../types/ServiceId';
import enMessages from '../../../_locales/en/messages.json';
import type { GroupV2ChangeType } from '../../groups';
import { SignalService as Proto } from '../../protobuf';
@ -16,13 +16,13 @@ import type { FullJSXType } from '../Intl';
const i18n = setupI18n('en', enMessages);
const OUR_ACI = UUID.generate().toString();
const OUR_PNI = UUID.generate().toString();
const CONTACT_A = UUID.generate().toString();
const CONTACT_B = UUID.generate().toString();
const CONTACT_C = UUID.generate().toString();
const ADMIN_A = UUID.generate().toString();
const INVITEE_A = UUID.generate().toString();
const OUR_ACI = generateAci();
const OUR_PNI = generatePni();
const CONTACT_A = generateAci();
const CONTACT_B = generateAci();
const CONTACT_C = generateAci();
const ADMIN_A = generateAci();
const INVITEE_A = generateAci();
const AccessControlEnum = Proto.AccessControl.AccessRequired;
const RoleEnum = Proto.Member.Role;
@ -44,10 +44,10 @@ const renderChange = (
areWeAdmin = true,
}: {
groupMemberships?: ReadonlyArray<{
uuid: UUIDStringType;
uuid: AciString;
isAdmin: boolean;
}>;
groupBannedMemberships?: ReadonlyArray<UUIDStringType>;
groupBannedMemberships?: ReadonlyArray<ServiceIdString>;
groupName?: string;
areWeAdmin?: boolean;
} = {}
@ -61,8 +61,8 @@ const renderChange = (
groupMemberships={groupMemberships}
groupName={groupName}
i18n={i18n}
ourACI={OUR_ACI}
ourPNI={OUR_PNI}
ourAci={OUR_ACI}
ourPni={OUR_PNI}
renderContact={renderContact}
/>
);
@ -94,10 +94,6 @@ export function Multiple(): JSX.Element {
type: 'member-add',
uuid: OUR_ACI,
},
{
type: 'member-add',
uuid: OUR_PNI,
},
{
type: 'description',
description: 'Another description',

View file

@ -10,7 +10,11 @@ import type { ReplacementValuesType } from '../../types/I18N';
import type { FullJSXType } from '../Intl';
import { Intl } from '../Intl';
import type { LocalizerType } from '../../types/Util';
import type { UUIDStringType } from '../../types/UUID';
import type {
AciString,
PniString,
ServiceIdString,
} from '../../types/ServiceId';
import { GroupDescriptionText } from '../GroupDescriptionText';
import { Button, ButtonSize, ButtonVariant } from '../Button';
import { SystemMessage } from './SystemMessage';
@ -26,20 +30,20 @@ export type PropsDataType = {
areWeAdmin: boolean;
conversationId: string;
groupMemberships?: ReadonlyArray<{
uuid: UUIDStringType;
uuid: AciString;
isAdmin: boolean;
}>;
groupBannedMemberships?: ReadonlyArray<UUIDStringType>;
groupBannedMemberships?: ReadonlyArray<ServiceIdString>;
groupName?: string;
ourACI?: UUIDStringType;
ourPNI?: UUIDStringType;
ourAci: AciString | undefined;
ourPni: PniString | undefined;
change: GroupV2ChangeType;
};
export type PropsActionsType = {
blockGroupLinkRequests: (
conversationId: string,
uuid: UUIDStringType
serviceId: ServiceIdString
) => unknown;
};
@ -108,7 +112,7 @@ const changeToIconMap = new Map<string, GroupIconType>([
function getIcon(
detail: GroupV2ChangeDetailType,
isLastText = true,
fromId?: UUIDStringType
fromId?: ServiceIdString
): GroupIconType {
const changeType = detail.type;
let possibleIcon = changeToIconMap.get(changeType);
@ -143,29 +147,27 @@ function GroupV2Detail({
groupBannedMemberships,
groupName,
i18n,
ourACI,
ourPNI,
ourAci,
renderContact,
text,
}: {
areWeAdmin: boolean;
blockGroupLinkRequests: (
conversationId: string,
uuid: UUIDStringType
uuid: ServiceIdString
) => unknown;
conversationId: string;
detail: GroupV2ChangeDetailType;
isLastText: boolean;
groupMemberships?: ReadonlyArray<{
uuid: UUIDStringType;
uuid: AciString;
isAdmin: boolean;
}>;
groupBannedMemberships?: ReadonlyArray<UUIDStringType>;
groupBannedMemberships?: ReadonlyArray<ServiceIdString>;
groupName?: string;
i18n: LocalizerType;
fromId?: UUIDStringType;
ourACI?: UUIDStringType;
ourPNI?: UUIDStringType;
fromId?: ServiceIdString;
ourAci: AciString | undefined;
renderContact: SmartContactRendererType<FullJSXType>;
text: FullJSXType;
}): JSX.Element {
@ -260,8 +262,7 @@ function GroupV2Detail({
detail.type === 'admin-approval-bounce' &&
areWeAdmin &&
detail.uuid &&
detail.uuid !== ourACI &&
detail.uuid !== ourPNI &&
detail.uuid !== ourAci &&
(!fromId || fromId === detail.uuid) &&
!groupMemberships?.some(item => item.uuid === detail.uuid) &&
!groupBannedMemberships?.some(uuid => uuid === detail.uuid)
@ -297,8 +298,8 @@ export function GroupV2Change(props: PropsType): ReactElement {
groupMemberships,
groupName,
i18n,
ourACI,
ourPNI,
ourAci,
ourPni,
renderContact,
} = props;
@ -306,8 +307,8 @@ export function GroupV2Change(props: PropsType): ReactElement {
<>
{renderChange<FullJSXType>(change, {
i18n,
ourACI,
ourPNI,
ourAci,
ourPni,
renderContact,
renderString: renderStringToIntl,
}).map(({ detail, isLastText, text }, index) => {
@ -326,8 +327,7 @@ export function GroupV2Change(props: PropsType): ReactElement {
// Difficult to find a unique key for this type
// eslint-disable-next-line react/no-array-index-key
key={index}
ourACI={ourACI}
ourPNI={ourPNI}
ourAci={ourAci}
renderContact={renderContact}
text={text}
/>

View file

@ -84,7 +84,7 @@ import type {
import { createRefMerger } from '../../util/refMerger';
import { emojiToData, getEmojiCount, hasNonEmojiText } from '../emoji/lib';
import { getCustomColorStyle } from '../../util/getCustomColorStyle';
import type { UUIDStringType } from '../../types/UUID';
import type { ServiceIdString } from '../../types/ServiceId';
import { DAY, HOUR, MINUTE, SECOND } from '../../util/durations';
import { BadgeImageTheme } from '../../badges/BadgeImageTheme';
import { getBadgeImageFileLocalPath } from '../../badges/getBadgeImageFileLocalPath';
@ -319,7 +319,7 @@ export type PropsActions = {
messageExpanded: (id: string, displayLimit: number) => unknown;
checkForAccount: (phoneNumber: string) => unknown;
startConversation: (e164: string, uuid: UUIDStringType) => void;
startConversation: (e164: string, uuid: ServiceIdString) => void;
showConversation: ShowConversationType;
openGiftBadge: (messageId: string) => void;
pushPanelForConversation: PushPanelForConversationActionType;

View file

@ -9,8 +9,21 @@ import { MessageBody } from './MessageBody';
import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import { BodyRange } from '../../types/BodyRange';
import { generateAci } from '../../types/ServiceId';
import { RenderLocation } from './MessageTextRenderer';
const SERVICE_ID_1 = generateAci();
const SERVICE_ID_2 = generateAci();
const SERVICE_ID_3 = generateAci();
const SERVICE_ID_4 = generateAci();
const SERVICE_ID_5 = generateAci();
const SERVICE_ID_6 = generateAci();
const SERVICE_ID_7 = generateAci();
const SERVICE_ID_8 = generateAci();
const SERVICE_ID_9 = generateAci();
const SERVICE_ID_10 = generateAci();
const SERVICE_ID_11 = generateAci();
const i18n = setupI18n('en', enMessages);
export default {
@ -115,7 +128,7 @@ export function Mention(): JSX.Element {
{
start: 5,
length: 1,
mentionUuid: 'tuv',
mentionUuid: SERVICE_ID_1,
replacementText: 'Bender B Rodriguez 🤖',
conversationID: 'x',
},
@ -137,21 +150,21 @@ export function MultipleMentions(): JSX.Element {
{
start: 2,
length: 1,
mentionUuid: 'def',
mentionUuid: SERVICE_ID_2,
replacementText: 'Philip J Fry',
conversationID: 'x',
},
{
start: 4,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_3,
replacementText: 'Professor Farnsworth',
conversationID: 'x',
},
{
start: 0,
length: 1,
mentionUuid: 'xyz',
mentionUuid: SERVICE_ID_4,
replacementText: 'Yancy Fry',
conversationID: 'x',
},
@ -179,21 +192,21 @@ export function ComplexMessageBody(): JSX.Element {
{
start: 78,
length: 1,
mentionUuid: 'wer',
mentionUuid: SERVICE_ID_5,
replacementText: 'Acid Burn',
conversationID: 'x',
},
{
start: 80,
length: 1,
mentionUuid: 'xox',
mentionUuid: SERVICE_ID_6,
replacementText: 'Cereal Killer',
conversationID: 'x',
},
{
start: 4,
length: 1,
mentionUuid: 'ldo',
mentionUuid: SERVICE_ID_6,
replacementText: 'Zero Cool',
conversationID: 'x',
},
@ -311,14 +324,14 @@ export function FormattingSpoiler(): JSX.Element {
{
start: 54,
length: 1,
mentionUuid: 'a',
mentionUuid: SERVICE_ID_7,
conversationID: 'a',
replacementText: '🅰️ Alice',
},
{
start: 60,
length: 1,
mentionUuid: 'b',
mentionUuid: SERVICE_ID_8,
conversationID: 'b',
replacementText: '🅱️ Bob',
},
@ -371,35 +384,35 @@ export function FormattingNesting(): JSX.Element {
{
start: 29,
length: 1,
mentionUuid: 'a',
mentionUuid: SERVICE_ID_7,
conversationID: 'a',
replacementText: '🅰️ Alice',
},
{
start: 61,
length: 1,
mentionUuid: 'b',
mentionUuid: SERVICE_ID_8,
conversationID: 'b',
replacementText: '🅱️ Bob',
},
{
start: 68,
length: 1,
mentionUuid: 'c',
mentionUuid: SERVICE_ID_9,
conversationID: 'c',
replacementText: 'Charlie',
},
{
start: 80,
length: 1,
mentionUuid: 'd',
mentionUuid: SERVICE_ID_10,
conversationID: 'd',
replacementText: 'Dan',
},
{
start: 105,
length: 1,
mentionUuid: 'e',
mentionUuid: SERVICE_ID_11,
conversationID: 'e',
replacementText: 'Eve',
},
@ -439,7 +452,7 @@ export function FormattingComplex(): JSX.Element {
{
start: 24,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_3,
conversationID: 'x',
replacementText: '🤖 Hello',
},
@ -471,7 +484,7 @@ export function FormattingComplex(): JSX.Element {
{
start: 491,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_3,
conversationID: 'x',
replacementText: '🤖 Hello',
},

View file

@ -11,6 +11,7 @@ import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import type { HydratedBodyRangesType } from '../../types/BodyRange';
import { BodyRange } from '../../types/BodyRange';
import { generateAci } from '../../types/ServiceId';
import { RenderLocation } from './MessageTextRenderer';
const i18n = setupI18n('en', enMessages);
@ -91,7 +92,7 @@ export function LongTextWithMention(): JSX.Element {
{
start: 800,
length: 1,
mentionUuid: 'abc',
mentionUuid: generateAci(),
conversationID: 'x',
replacementText: 'Alice',
},

View file

@ -35,6 +35,7 @@ import { getDefaultConversation } from '../../test-both/helpers/getDefaultConver
import { WidthBreakpoint } from '../_util';
import { DAY, HOUR, MINUTE, SECOND } from '../../util/durations';
import { ContactFormType } from '../../types/EmbeddedContact';
import { generateAci } from '../../types/ServiceId';
import {
fakeAttachment,
@ -42,7 +43,6 @@ import {
} from '../../test-both/helpers/fakeAttachment';
import { getFakeBadge } from '../../test-both/helpers/getFakeBadge';
import { ThemeType } from '../../types/Util';
import { UUID } from '../../types/UUID';
import { BadgeCategory } from '../../badges/BadgeCategory';
import { PaymentEventKind } from '../../types/Payment';
@ -1676,7 +1676,7 @@ Mentions.args = {
{
start: 0,
length: 1,
mentionUuid: 'zap',
mentionUuid: generateAci(),
replacementText: 'Zapp Brannigan',
conversationID: 'x',
},
@ -1944,7 +1944,7 @@ EmbeddedContactWithSendMessage.args = {
contact: {
...fullContact,
firstNumber: fullContact.number[0].value,
uuid: UUID.generate().toString(),
uuid: generateAci(),
},
direction: 'incoming',
};

View file

@ -19,7 +19,7 @@ import { ChooseGroupMembersModal } from './AddGroupMembersModal/ChooseGroupMembe
import { ConfirmAdditionsModal } from './AddGroupMembersModal/ConfirmAdditionsModal';
import { RequestState } from './util';
import { ThemeType } from '../../../types/Util';
import { makeFakeLookupConversationWithoutUuid } from '../../../test-both/helpers/fakeLookupConversationWithoutUuid';
import { makeFakeLookupConversationWithoutServiceId } from '../../../test-both/helpers/fakeLookupConversationWithoutServiceId';
const i18n = setupI18n('en', enMessages);
@ -30,12 +30,11 @@ export default {
const allCandidateContacts = times(50, () => getDefaultConversation());
let allCandidateContactsLookup = makeLookup(allCandidateContacts, 'id');
const lookupConversationWithoutUuid = makeFakeLookupConversationWithoutUuid(
convo => {
const lookupConversationWithoutServiceId =
makeFakeLookupConversationWithoutServiceId(convo => {
allCandidateContacts.push(convo);
allCandidateContactsLookup = makeLookup(allCandidateContacts, 'id');
}
);
});
type PropsType = ComponentProps<typeof AddGroupMembersModal>;
@ -68,7 +67,7 @@ const createProps = (
getPreferredBadge={() => undefined}
theme={ThemeType.light}
i18n={i18n}
lookupConversationWithoutUuid={lookupConversationWithoutUuid}
lookupConversationWithoutServiceId={lookupConversationWithoutServiceId}
showUserNotFoundModal={action('showUserNotFoundModal')}
isUsernamesEnabled
/>

View file

@ -17,7 +17,7 @@ import { strictAssert, assertDev } from '../../../../util/assert';
import { refMerger } from '../../../../util/refMerger';
import { useRestoreFocus } from '../../../../hooks/useRestoreFocus';
import { missingCaseError } from '../../../../util/missingCaseError';
import type { LookupConversationWithoutUuidActionsType } from '../../../../util/lookupConversationWithoutUuid';
import type { LookupConversationWithoutServiceIdActionsType } from '../../../../util/lookupConversationWithoutServiceId';
import { parseAndFormatPhoneNumber } from '../../../../util/libphonenumberInstance';
import type { ParsedE164Type } from '../../../../util/libphonenumberInstance';
import { filterAndSortConversationsByRecent } from '../../../../util/filterAndSortConversations';
@ -65,13 +65,13 @@ export type StatePropsType = {
toggleSelectedContact: (conversationId: string) => void;
isUsernamesEnabled: boolean;
} & Pick<
LookupConversationWithoutUuidActionsType,
'lookupConversationWithoutUuid'
LookupConversationWithoutServiceIdActionsType,
'lookupConversationWithoutServiceId'
>;
type ActionPropsType = Omit<
LookupConversationWithoutUuidActionsType,
'setIsFetchingUUID' | 'lookupConversationWithoutUuid'
LookupConversationWithoutServiceIdActionsType,
'setIsFetchingUUID' | 'lookupConversationWithoutServiceId'
>;
type PropsType = StatePropsType & ActionPropsType;
@ -91,7 +91,7 @@ export function ChooseGroupMembersModal({
setSearchTerm,
theme,
toggleSelectedContact,
lookupConversationWithoutUuid,
lookupConversationWithoutServiceId,
showUserNotFoundModal,
isUsernamesEnabled,
}: PropsType): JSX.Element {
@ -345,7 +345,9 @@ export function ChooseGroupMembersModal({
}
showUserNotFoundModal={showUserNotFoundModal}
setIsFetchingUUID={setIsFetchingUUID}
lookupConversationWithoutUuid={lookupConversationWithoutUuid}
lookupConversationWithoutServiceId={
lookupConversationWithoutServiceId
}
/>
);
break;
@ -353,7 +355,9 @@ export function ChooseGroupMembersModal({
item = (
<PhoneNumberCheckbox
phoneNumber={row.phoneNumber}
lookupConversationWithoutUuid={lookupConversationWithoutUuid}
lookupConversationWithoutServiceId={
lookupConversationWithoutServiceId
}
showUserNotFoundModal={showUserNotFoundModal}
setIsFetchingUUID={setIsFetchingUUID}
toggleConversationInChooseMembers={conversationId =>

View file

@ -14,7 +14,7 @@ import { ChooseGroupMembersModal } from './AddGroupMembersModal/ChooseGroupMembe
import { ConfirmAdditionsModal } from './AddGroupMembersModal/ConfirmAdditionsModal';
import type { ConversationType } from '../../../state/ducks/conversations';
import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation';
import { makeFakeLookupConversationWithoutUuid } from '../../../test-both/helpers/fakeLookupConversationWithoutUuid';
import { makeFakeLookupConversationWithoutServiceId } from '../../../test-both/helpers/fakeLookupConversationWithoutServiceId';
import { ThemeType } from '../../../types/Util';
import { DurationInSeconds } from '../../../util/durations';
import { NavTab } from '../../../state/ducks/nav';
@ -120,7 +120,7 @@ const createProps = (
getPreferredBadge={() => undefined}
theme={ThemeType.light}
i18n={i18n}
lookupConversationWithoutUuid={makeFakeLookupConversationWithoutUuid()}
lookupConversationWithoutServiceId={makeFakeLookupConversationWithoutServiceId()}
showUserNotFoundModal={action('showUserNotFoundModal')}
isUsernamesEnabled
/>

View file

@ -6,7 +6,7 @@ import { times } from 'lodash';
import { action } from '@storybook/addon-actions';
import { UUID } from '../../../types/UUID';
import { generateAci } from '../../../types/ServiceId';
import { StorySendMode } from '../../../types/Stories';
import { setupI18n } from '../../../util/setupI18n';
import enMessages from '../../../../_locales/en/messages.json';
@ -45,7 +45,7 @@ const conversation: ConversationType = {
storySendMode: StorySendMode.IfActive,
};
const OUR_UUID = UUID.generate().toString();
const OUR_UUID = generateAci();
const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
approvePendingMembershipFromGroupV2: action(
@ -54,7 +54,7 @@ const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
conversation,
getPreferredBadge: () => undefined,
i18n,
ourUuid: OUR_UUID,
ourAci: OUR_UUID,
pendingApprovalMemberships: times(5, () => ({
member: getDefaultConversation(),
})),
@ -68,7 +68,7 @@ const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
...times(8, () => ({
member: getDefaultConversation(),
metadata: {
addedByUserId: UUID.generate().toString(),
addedByUserId: generateAci(),
},
})),
],

View file

@ -7,7 +7,7 @@ import _ from 'lodash';
import type { ConversationType } from '../../../state/ducks/conversations';
import type { LocalizerType, ThemeType } from '../../../types/Util';
import type { PreferredBadgeSelectorType } from '../../../state/selectors/badges';
import type { UUIDStringType } from '../../../types/UUID';
import type { AciString } from '../../../types/ServiceId';
import { Avatar, AvatarSize } from '../../Avatar';
import { ConfirmationDialog } from '../../ConfirmationDialog';
import { PanelSection } from './PanelSection';
@ -21,7 +21,7 @@ export type PropsDataType = {
readonly conversation?: ConversationType;
readonly getPreferredBadge: PreferredBadgeSelectorType;
readonly i18n: LocalizerType;
readonly ourUuid: UUIDStringType;
readonly ourAci: AciString;
readonly pendingApprovalMemberships: ReadonlyArray<GroupV2RequestingMembership>;
readonly pendingMemberships: ReadonlyArray<GroupV2PendingMembership>;
readonly theme: ThemeType;
@ -42,7 +42,7 @@ export type PropsType = PropsDataType & PropsActionType;
export type GroupV2PendingMembership = {
metadata: {
addedByUserId?: UUIDStringType;
addedByUserId?: AciString;
};
member: ConversationType;
};
@ -72,16 +72,14 @@ export function PendingInvites({
conversation,
getPreferredBadge,
i18n,
ourUuid,
ourAci,
pendingMemberships,
pendingApprovalMemberships,
revokePendingMembershipsFromGroupV2,
theme,
}: PropsType): JSX.Element {
if (!conversation || !ourUuid) {
throw new Error(
'PendingInvites rendered without a conversation or ourUuid'
);
if (!conversation || !ourAci) {
throw new Error('PendingInvites rendered without a conversation or ourAci');
}
const [stagedMemberships, setStagedMemberships] =
@ -126,7 +124,7 @@ export function PendingInvites({
i18n={i18n}
members={conversation.sortedGroupMembers || []}
memberships={pendingMemberships}
ourUuid={ourUuid}
ourAci={ourAci}
setStagedMemberships={setStagedMemberships}
theme={theme}
/>
@ -144,7 +142,7 @@ export function PendingInvites({
i18n={i18n}
members={conversation.sortedGroupMembers || []}
onClose={() => setStagedMemberships(null)}
ourUuid={ourUuid}
ourAci={ourAci}
revokePendingMembershipsFromGroupV2={
revokePendingMembershipsFromGroupV2
}
@ -161,7 +159,7 @@ function MembershipActionConfirmation({
i18n,
members,
onClose,
ourUuid,
ourAci,
revokePendingMembershipsFromGroupV2,
stagedMemberships,
}: {
@ -173,7 +171,7 @@ function MembershipActionConfirmation({
i18n: LocalizerType;
members: ReadonlyArray<ConversationType>;
onClose: () => void;
ourUuid: string;
ourAci: AciString;
revokePendingMembershipsFromGroupV2: (
conversationId: string,
memberIds: ReadonlyArray<string>
@ -234,7 +232,7 @@ function MembershipActionConfirmation({
conversation,
i18n,
members,
ourUuid,
ourAci,
stagedMemberships,
})}
</ConfirmationDialog>
@ -245,13 +243,13 @@ function getConfirmationMessage({
conversation,
i18n,
members,
ourUuid,
ourAci,
stagedMemberships,
}: Readonly<{
conversation: ConversationType;
i18n: LocalizerType;
members: ReadonlyArray<ConversationType>;
ourUuid: string;
ourAci: AciString;
stagedMemberships: ReadonlyArray<StagedMembershipType>;
}>): string {
if (!stagedMemberships || !stagedMemberships.length) {
@ -285,7 +283,7 @@ function getConfirmationMessage({
const firstPendingMembership = firstMembership as GroupV2PendingMembership;
// Pending invite
const invitedByUs = firstPendingMembership.metadata.addedByUserId === ourUuid;
const invitedByUs = firstPendingMembership.metadata.addedByUserId === ourAci;
if (invitedByUs) {
return i18n('icu:PendingInvites--revoke-for', {
@ -391,7 +389,7 @@ function MembersPendingProfileKey({
i18n,
members,
memberships,
ourUuid,
ourAci,
setStagedMemberships,
getPreferredBadge,
theme,
@ -401,7 +399,7 @@ function MembersPendingProfileKey({
i18n: LocalizerType;
members: ReadonlyArray<ConversationType>;
memberships: ReadonlyArray<GroupV2PendingMembership>;
ourUuid: string;
ourAci: AciString;
setStagedMemberships: (stagedMembership: Array<StagedMembershipType>) => void;
theme: ThemeType;
}>) {
@ -410,7 +408,7 @@ function MembersPendingProfileKey({
membership => membership.metadata.addedByUserId
);
const { [ourUuid]: ourPendingMemberships, ...otherPendingMembershipGroups } =
const { [ourAci]: ourPendingMemberships, ...otherPendingMembershipGroups } =
groupedPendingMemberships;
const otherPendingMemberships = Object.keys(otherPendingMembershipGroups)