Introduce Service Id Types
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
414c0a58d3
commit
366b875fd2
269 changed files with 5832 additions and 5550 deletions
|
@ -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}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue