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

1688 lines
33 KiB
TypeScript
Raw Normal View History

2022-06-03 21:07:51 +00:00
// Copyright 2020-2022 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';
2020-09-09 02:25:05 +00:00
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../../util/setupI18n';
2021-10-26 22:59:08 +00:00
import { UUID } from '../../types/UUID';
import type { UUIDStringType } from '../../types/UUID';
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';
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);
2022-07-08 20:46:25 +00:00
const OUR_ACI = UUID.generate().toString();
const OUR_PNI = UUID.generate().toString();
2021-10-26 22:59:08 +00:00
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();
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?: Array<{
uuid: UUIDStringType;
isAdmin: boolean;
}>;
groupBannedMemberships?: Array<UUIDStringType>;
groupName?: string;
areWeAdmin?: boolean;
} = {}
) => (
2020-09-09 02:25:05 +00:00
<GroupV2Change
areWeAdmin={areWeAdmin ?? true}
blockGroupLinkRequests={action('blockGroupLinkRequests')}
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}
2022-07-08 20:46:25 +00:00
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',
};
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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
},
{
type: 'member-add',
uuid: OUR_PNI,
2022-06-07 00:48:02 +00:00
},
{
type: 'description',
description: 'Another description',
},
{
type: 'member-privilege',
2022-07-08 20:46:25 +00:00
uuid: 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
AccessAttributes.story = {
name: 'Access (Attributes)',
};
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
AccessMembers.story = {
name: 'Access (Members)',
};
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
AccessInviteLink.story = {
name: 'Access (Invite Link)',
};
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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'member-add',
uuid: CONTACT_A,
},
],
})}
{renderChange({
details: [
{
type: 'member-add',
uuid: 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 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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-invite',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
uuid: CONTACT_B,
inviter: CONTACT_C,
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-invite',
uuid: CONTACT_A,
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',
2022-07-08 20:46:25 +00:00
uuid: 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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
uuid: 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',
uuid: CONTACT_A,
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-invite',
uuid: CONTACT_A,
},
],
})}
2022-07-08 20:46:25 +00:00
ACI accepts PNI invite:
{renderChange({
from: OUR_PNI,
details: [
{
type: 'member-add-from-invite',
uuid: OUR_ACI,
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
MemberAddFromInvited.story = {
name: 'Member Add (from invited)',
};
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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-add-from-link',
uuid: CONTACT_A,
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-link',
uuid: CONTACT_A,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
MemberAddFromLink.story = {
name: 'Member Add (from link)',
};
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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-admin-approval',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-add-from-admin-approval',
uuid: CONTACT_A,
},
],
})}
{renderChange({
details: [
{
type: 'member-add-from-admin-approval',
uuid: CONTACT_A,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
MemberAddFromAdminApproval.story = {
name: 'Member Add (from admin approval)',
};
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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-remove',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'member-remove',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-remove',
uuid: CONTACT_A,
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'member-remove',
uuid: CONTACT_A,
},
],
})}
{renderChange({
details: [
{
type: 'member-remove',
uuid: 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 MemberPrivilege(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-privilege',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-privilege',
uuid: CONTACT_A,
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
uuid: CONTACT_A,
newPrivilege: RoleEnum.ADMINISTRATOR,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'member-privilege',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
from: ADMIN_A,
details: [
{
type: 'member-privilege',
uuid: CONTACT_A,
newPrivilege: RoleEnum.DEFAULT,
},
],
})}
{renderChange({
details: [
{
type: 'member-privilege',
uuid: CONTACT_A,
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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'pending-add-one',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: INVITEE_A,
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'pending-add-one',
uuid: INVITEE_A,
},
],
})}
{renderChange({
details: [
{
type: 'pending-add-one',
uuid: INVITEE_A,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
PendingAddOne.story = {
name: 'Pending Add - one',
};
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
PendingAddMany.story = {
name: 'Pending Add - many',
};
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',
uuid: 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',
uuid: 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',
uuid: 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',
uuid: 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',
uuid: INVITEE_A,
},
],
})}
{renderChange({
from: INVITEE_A,
details: [
{
type: 'pending-remove-one',
uuid: INVITEE_A,
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'pending-remove-one',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
inviter: CONTACT_B,
},
],
})}
{renderChange({
from: CONTACT_A,
details: [
{
type: 'pending-remove-one',
uuid: CONTACT_B,
inviter: CONTACT_A,
},
],
})}
{renderChange({
from: CONTACT_C,
details: [
{
type: 'pending-remove-one',
uuid: INVITEE_A,
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',
uuid: INVITEE_A,
inviter: CONTACT_B,
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-one',
uuid: INVITEE_A,
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',
uuid: INVITEE_A,
},
],
})}
{renderChange({
from: CONTACT_B,
details: [
{
type: 'pending-remove-one',
uuid: INVITEE_A,
},
],
})}
{renderChange({
details: [
{
type: 'pending-remove-one',
uuid: INVITEE_A,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
PendingRemoveOne.story = {
name: 'Pending Remove - one',
};
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-06-07 00:48:02 +00:00
PendingRemoveMany.story = {
name: 'Pending Remove - many',
};
2020-09-09 02:25:05 +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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'admin-approval-add-one',
uuid: CONTACT_A,
},
],
})}
</>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
AdminApprovalAdd.story = {
name: 'Admin Approval (Add)',
};
2020-09-09 02:25:05 +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',
2022-07-08 20:46:25 +00:00
uuid: OUR_ACI,
2022-06-07 00:48:02 +00:00
},
],
})}
{renderChange({
details: [
{
type: 'admin-approval-remove-one',
2022-07-08 20:46:25 +00:00
uuid: 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',
uuid: CONTACT_A,
},
],
})}
</>
);
}
AdminApprovalRemove.story = {
name: 'Admin Approval (Remove)',
};
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',
2021-10-26 22:59:08 +00:00
uuid: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{
groupMemberships: [{ uuid: CONTACT_C, isAdmin: false }],
groupBannedMemberships: [CONTACT_B],
}
)}
{renderChange(
{
// From nobody
details: [
{
type: 'admin-approval-bounce',
2022-06-07 00:48:02 +00:00
uuid: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{
groupMemberships: [{ uuid: CONTACT_C, isAdmin: false }],
groupBannedMemberships: [CONTACT_B],
}
)}
{renderChange({
details: [
{
type: 'admin-approval-bounce',
uuid: 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',
2022-06-07 00:48:02 +00:00
uuid: 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',
2021-10-26 22:59:08 +00:00
uuid: CONTACT_A,
times: 1,
isApprovalPending: false,
},
],
2022-06-07 00:48:02 +00:00
},
{ groupMemberships: [{ uuid: CONTACT_A, isAdmin: false }] }
)}
Would show button, but user is already banned:
{renderChange(
{
from: CONTACT_A,
details: [
{
type: 'admin-approval-bounce',
2021-10-26 22:59:08 +00:00
uuid: 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
AdminApprovalBounce.story = {
name: 'Admin Approval (Bounce)',
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-06-07 00:48:02 +00:00
GroupLinkAdd.story = {
name: 'Group Link (Add)',
};
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-06-07 00:48:02 +00:00
GroupLinkReset.story = {
name: 'Group Link (Reset)',
};
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
GroupLinkRemove.story = {
name: 'Group Link (Remove)',
};
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
DescriptionRemove.story = {
name: 'Description (Remove)',
};
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
DescriptionChange.story = {
name: 'Description (Change)',
};
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
AnnouncementGroupChange.story = {
name: 'Announcement Group (Change)',
};
export function Summary(): JSX.Element {
return (
<>
{renderChange({
from: OUR_ACI,
details: [
{
type: 'summary',
},
],
})}
</>
);
}