signal-desktop/ts/components/conversation/GroupV2Change.stories.tsx

1610 lines
32 KiB
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
2020-09-09 02:25:05 +00:00
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../../util/setupI18n';
import { generateAci, generatePni } from '../../types/ServiceId';
import type { ServiceIdString, AciString } from '../../types/ServiceId';
2020-09-09 02:25:05 +00:00
import enMessages from '../../../_locales/en/messages.json';
import type { GroupV2ChangeType } from '../../groups';
2021-07-09 19:36:10 +00:00
import { SignalService as Proto } from '../../protobuf';
import type { SmartContactRendererType } from '../../groupChange';
import type { PropsType } from './GroupV2Change';
2020-09-09 02:25:05 +00:00
import { GroupV2Change } from './GroupV2Change';
import type { FullJSXType } from '../Intl';
2020-09-09 02:25:05 +00:00
const i18n = setupI18n('en', enMessages);
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();
2020-09-09 02:25:05 +00:00
2021-07-09 19:36:10 +00:00
const AccessControlEnum = Proto.AccessControl.AccessRequired;
const RoleEnum = Proto.Member.Role;
2020-09-09 02:25:05 +00:00
const renderContact: SmartContactRendererType<FullJSXType> = (
conversationId: string
) => (
2020-09-09 02:25:05 +00:00
<React.Fragment key={conversationId}>
{`Conversation(${conversationId})`}
</React.Fragment>
);
const renderChange = (
change: GroupV2ChangeType,
{
groupBannedMemberships,
groupMemberships,
groupName,
areWeAdmin = true,
}: {
groupMemberships?: ReadonlyArray<{
2023-08-16 20:54:39 +00:00
aci: AciString;
isAdmin: boolean;
}>;
groupBannedMemberships?: ReadonlyArray<ServiceIdString>;
groupName?: string;
areWeAdmin?: boolean;
} = {}
) => (
2020-09-09 02:25:05 +00:00
<GroupV2Change
areWeAdmin={areWeAdmin ?? true}
blockGroupLinkRequests={action('blockGroupLinkRequests')}
conversationId="some-conversation-id"
2020-09-09 02:25:05 +00:00
change={change}
groupBannedMemberships={groupBannedMemberships}
groupMemberships={groupMemberships}
groupName={groupName}
2020-09-09 02:25:05 +00:00
i18n={i18n}
ourAci={OUR_ACI}
ourPni={OUR_PNI}
2020-09-09 02:25:05 +00:00
renderContact={renderContact}
/>
);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Conversation/GroupV2Change',
} satisfies Meta<PropsType>;
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function Multiple(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
from: CONTACT_A,
details: [
{
type: 'title',
newTitle: 'Saturday Running',
},
{
type: 'avatar',
removed: false,
},
{
type: 'description',
description:
'This is a long description.\n\nWe need a dialog to view it all!\n\nIt has a link to https://example.com',
},
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-07-08 20:46:25 +00:00
},
2022-06-07 00:48:02 +00:00
{
type: 'description',
description: 'Another description',
},
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function Create(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'create',
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'create',
},
],
})}
{renderChange({
details: [
{
type: 'create',
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function Title(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'title',
newTitle: 'Saturday Running',
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'title',
newTitle: 'Saturday Running',
},
],
})}
{renderChange({
details: [
{
type: 'title',
newTitle: 'Saturday Running',
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'title',
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'title',
},
],
})}
{renderChange({
details: [
{
type: 'title',
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function Avatar(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'avatar',
removed: false,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'avatar',
removed: false,
},
],
})}
{renderChange({
details: [
{
type: 'avatar',
removed: false,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'avatar',
removed: true,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'avatar',
removed: true,
},
],
})}
{renderChange({
details: [
{
type: 'avatar',
removed: true,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function AccessAttributes(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'access-attributes',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'access-attributes',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'access-attributes',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'access-attributes',
newPrivilege: AccessControlEnum.MEMBER,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'access-attributes',
newPrivilege: AccessControlEnum.MEMBER,
},
],
})}
{renderChange({
details: [
{
type: 'access-attributes',
newPrivilege: AccessControlEnum.MEMBER,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function AccessMembers(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'access-members',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'access-members',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'access-members',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'access-members',
newPrivilege: AccessControlEnum.MEMBER,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'access-members',
newPrivilege: AccessControlEnum.MEMBER,
},
],
})}
{renderChange({
details: [
{
type: 'access-members',
newPrivilege: AccessControlEnum.MEMBER,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function AccessInviteLink(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'access-invite-link',
newPrivilege: AccessControlEnum.ANY,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'access-invite-link',
newPrivilege: AccessControlEnum.ANY,
},
],
})}
{renderChange({
details: [
{
type: 'access-invite-link',
newPrivilege: AccessControlEnum.ANY,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'access-invite-link',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'access-invite-link',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'access-invite-link',
newPrivilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function MemberAdd(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function MemberAddFromInvited(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{/* the strings where someone added you - shown like a normal add */}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_A,
},
],
})}
{/* the rest of the 'someone added someone else' checks */}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: CONTACT_B,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_C,
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{/* in all of these we know the user has accepted the invite */}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_A,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
2022-07-08 20:46:25 +00:00
ACI accepts PNI invite:
{renderChange({
from: OUR_PNI,
details: [
{
type: 'member-add-from-invite',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-07-08 20:46:25 +00:00
inviter: CONTACT_B,
},
],
})}
2022-06-07 00:48:02 +00:00
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function MemberAddFromLink(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add-from-link',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-link',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-link',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function MemberAddFromAdminApproval(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-add-from-admin-approval',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-admin-approval',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-add-from-admin-approval',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-add-from-admin-approval',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-admin-approval',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function MemberRemove(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-remove',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function MemberPrivilege(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function PendingAddOne(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
from: CONTACT_A,
details: [
{
type: 'pending-add-one',
2023-08-16 20:54:39 +00:00
serviceId: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'pending-add-one',
2023-08-16 20:54:39 +00:00
serviceId: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-add-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'pending-add-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'pending-add-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function PendingAddMany(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-add-many',
count: 5,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'pending-add-many',
count: 5,
},
],
})}
{renderChange({
details: [
{
type: 'pending-add-many',
count: 5,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function PendingRemoveOne(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
from: INVITEE_A,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: INVITEE_A,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: INVITEE_A,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: OUR_ACI,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: CONTACT_B,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_A,
},
],
})}
{renderChange({
from: CONTACT_C,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-one',
2023-08-16 20:54:39 +00:00
serviceId: INVITEE_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function PendingRemoveMany(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-remove-many',
count: 5,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'pending-remove-many',
count: 5,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-many',
count: 5,
2022-07-08 20:46:25 +00:00
inviter: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-remove-many',
count: 5,
inviter: CONTACT_A,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'pending-remove-many',
count: 5,
inviter: CONTACT_A,
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-many',
count: 5,
inviter: CONTACT_A,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'pending-remove-many',
count: 5,
},
],
})}
2020-10-06 17:06:34 +00:00
2022-06-07 00:48:02 +00:00
{renderChange({
from: CONTACT_A,
details: [
{
type: 'pending-remove-many',
count: 5,
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-many',
count: 5,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2020-10-06 17:06:34 +00:00
2022-11-18 00:45:19 +00:00
export function AdminApprovalAdd(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
details: [
{
type: 'admin-approval-add-one',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'admin-approval-add-one',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function AdminApprovalRemove(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'admin-approval-remove-one',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'admin-approval-remove-one',
2023-08-16 20:54:39 +00:00
aci: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'admin-approval-remove-one',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
2022-06-07 00:48:02 +00:00
},
],
})}
</>
);
}
export function AdminApprovalBounce(): JSX.Element {
return (
<>
2022-06-07 00:48:02 +00:00
Should show button:
{renderChange(
{
// From Joiner
2020-09-09 02:25:05 +00:00
from: CONTACT_A,
details: [
{
type: 'admin-approval-bounce',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{
2023-08-16 20:54:39 +00:00
groupMemberships: [{ aci: CONTACT_C, isAdmin: false }],
2022-06-07 00:48:02 +00:00
groupBannedMemberships: [CONTACT_B],
}
)}
{renderChange(
{
// From nobody
details: [
{
type: 'admin-approval-bounce',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{
2023-08-16 20:54:39 +00:00
groupMemberships: [{ aci: CONTACT_C, isAdmin: false }],
2022-06-07 00:48:02 +00:00
groupBannedMemberships: [CONTACT_B],
}
)}
{renderChange({
details: [
{
type: 'admin-approval-bounce',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
times: 1,
isApprovalPending: false,
},
// No group membership info
],
})}
2022-06-07 00:48:02 +00:00
Would show button, but we&apos;re not admin:
{renderChange(
{
from: CONTACT_A,
details: [
{
type: 'admin-approval-bounce',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{ areWeAdmin: false, groupName: 'Group 1' }
)}
Would show button, but user is a group member:
{renderChange(
{
from: CONTACT_A,
details: [
{
type: 'admin-approval-bounce',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
2023-08-16 20:54:39 +00:00
{ groupMemberships: [{ aci: CONTACT_A, isAdmin: false }] }
2022-06-07 00:48:02 +00:00
)}
Would show button, but user is already banned:
{renderChange(
{
from: CONTACT_A,
details: [
{
type: 'admin-approval-bounce',
2023-08-16 20:54:39 +00:00
aci: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{ groupBannedMemberships: [CONTACT_A] }
)}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function GroupLinkAdd(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'group-link-add',
privilege: AccessControlEnum.ANY,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'group-link-add',
privilege: AccessControlEnum.ANY,
},
],
})}
{renderChange({
details: [
{
type: 'group-link-add',
privilege: AccessControlEnum.ANY,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'group-link-add',
privilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'group-link-add',
privilege: AccessControlEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'group-link-add',
privilege: AccessControlEnum.ADMINISTRATOR,
},
2022-06-07 00:48:02 +00:00
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-11-18 00:45:19 +00:00
export function GroupLinkReset(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'group-link-reset',
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'group-link-reset',
},
2022-06-07 00:48:02 +00:00
],
})}
{renderChange({
details: [
{
type: 'group-link-reset',
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-11-18 00:45:19 +00:00
export function GroupLinkRemove(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'group-link-remove',
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'group-link-remove',
},
],
})}
{renderChange({
details: [
{
type: 'group-link-remove',
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function DescriptionRemove(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
removed: true,
type: 'description',
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
removed: true,
type: 'description',
},
],
})}
{renderChange({
details: [
{
removed: true,
type: 'description',
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function DescriptionChange(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange(
{
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2021-06-02 00:24:28 +00:00
details: [
{
type: 'description',
2022-06-07 00:48:02 +00:00
description:
'This is a long description.\n\nWe need a dialog to view it all!\n\nIt has a link to https://example.com',
2021-06-02 00:24:28 +00:00
},
],
2022-06-07 00:48:02 +00:00
},
{ groupName: 'We do hikes 🌲' }
)}
{renderChange(
{
2021-06-02 00:24:28 +00:00
from: ADMIN_A,
details: [
{
type: 'description',
2022-06-07 00:48:02 +00:00
description:
'This is a long description.\n\nWe need a dialog to view it all!\n\nIt has a link to https://example.com',
2021-06-02 00:24:28 +00:00
},
],
2022-06-07 00:48:02 +00:00
},
{ groupName: 'We do hikes 🌲' }
)}
{renderChange(
{
2021-06-02 00:24:28 +00:00
details: [
{
type: 'description',
2022-06-07 00:48:02 +00:00
description:
'This is a long description.\n\nWe need a dialog to view it all!\n\nIt has a link to https://example.com',
2021-06-02 00:24:28 +00:00
},
],
2022-06-07 00:48:02 +00:00
},
{ groupName: 'We do hikes 🌲' }
)}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
2022-11-18 00:45:19 +00:00
export function AnnouncementGroupChange(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'announcements-only',
announcementsOnly: true,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'announcements-only',
announcementsOnly: true,
},
],
})}
{renderChange({
details: [
{
type: 'announcements-only',
announcementsOnly: true,
},
],
})}
{renderChange({
2022-07-08 20:46:25 +00:00
from: OUR_ACI,
2022-06-07 00:48:02 +00:00
details: [
{
type: 'announcements-only',
announcementsOnly: false,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'announcements-only',
announcementsOnly: false,
},
],
})}
{renderChange({
details: [
{
type: 'announcements-only',
announcementsOnly: false,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
export function Summary(): JSX.Element {
return (
<>
{renderChange({
from: OUR_ACI,
details: [
{
type: 'summary',
},
],
})}
</>
);
}