| 
									
										
										
										
											2023-01-03 11:55:46 -08:00
										 |  |  | // Copyright 2020 Signal Messenger, LLC
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:34:04 -05:00
										 |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | import type { ReactElement, ReactNode } from 'react'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import React, { useState } from 'react'; | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  | import { get } from 'lodash'; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | import * as log from '../../logging/log'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { ReplacementValuesType } from '../../types/I18N'; | 
					
						
							|  |  |  | import type { FullJSXType } from '../Intl'; | 
					
						
							|  |  |  | import { Intl } from '../Intl'; | 
					
						
							|  |  |  | import type { LocalizerType } from '../../types/Util'; | 
					
						
							| 
									
										
										
										
											2021-10-26 15:59:08 -07:00
										 |  |  | import type { UUIDStringType } from '../../types/UUID'; | 
					
						
							| 
									
										
										
										
											2021-06-17 12:15:51 -05:00
										 |  |  | import { GroupDescriptionText } from '../GroupDescriptionText'; | 
					
						
							| 
									
										
										
										
											2021-06-04 09:27:04 -07:00
										 |  |  | import { Button, ButtonSize, ButtonVariant } from '../Button'; | 
					
						
							| 
									
										
										
										
											2021-09-07 14:55:03 -05:00
										 |  |  | import { SystemMessage } from './SystemMessage'; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { GroupV2ChangeType, GroupV2ChangeDetailType } from '../../groups'; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { SmartContactRendererType } from '../../groupChange'; | 
					
						
							|  |  |  | import { renderChange } from '../../groupChange'; | 
					
						
							| 
									
										
										
										
											2021-06-04 09:27:04 -07:00
										 |  |  | import { Modal } from '../Modal'; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | import { ConfirmationDialog } from '../ConfirmationDialog'; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export type PropsDataType = { | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   areWeAdmin: boolean; | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |   conversationId: string; | 
					
						
							| 
									
										
										
										
											2022-12-21 16:07:02 -08:00
										 |  |  |   groupMemberships?: ReadonlyArray<{ | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |     uuid: UUIDStringType; | 
					
						
							|  |  |  |     isAdmin: boolean; | 
					
						
							|  |  |  |   }>; | 
					
						
							| 
									
										
										
										
											2022-12-21 16:07:02 -08:00
										 |  |  |   groupBannedMemberships?: ReadonlyArray<UUIDStringType>; | 
					
						
							| 
									
										
										
										
											2021-06-04 09:27:04 -07:00
										 |  |  |   groupName?: string; | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |   ourACI?: UUIDStringType; | 
					
						
							|  |  |  |   ourPNI?: UUIDStringType; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  |   change: GroupV2ChangeType; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | export type PropsActionsType = { | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |   blockGroupLinkRequests: ( | 
					
						
							|  |  |  |     conversationId: string, | 
					
						
							|  |  |  |     uuid: UUIDStringType | 
					
						
							|  |  |  |   ) => unknown; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | export type PropsHousekeepingType = { | 
					
						
							|  |  |  |   i18n: LocalizerType; | 
					
						
							| 
									
										
										
										
											2021-12-16 09:44:54 -08:00
										 |  |  |   renderContact: SmartContactRendererType<FullJSXType>; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | export type PropsType = PropsDataType & | 
					
						
							|  |  |  |   PropsActionsType & | 
					
						
							|  |  |  |   PropsHousekeepingType; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | function renderStringToIntl( | 
					
						
							|  |  |  |   id: string, | 
					
						
							|  |  |  |   i18n: LocalizerType, | 
					
						
							|  |  |  |   components?: Array<FullJSXType> | ReplacementValuesType<FullJSXType> | 
					
						
							|  |  |  | ): FullJSXType { | 
					
						
							| 
									
										
										
										
											2023-01-05 14:43:33 -08:00
										 |  |  |   // eslint-disable-next-line local-rules/valid-i18n-keys
 | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  |   return <Intl id={id} i18n={i18n} components={components} />; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | enum ModalState { | 
					
						
							|  |  |  |   None = 'None', | 
					
						
							|  |  |  |   ViewingGroupDescription = 'ViewingGroupDescription', | 
					
						
							|  |  |  |   ConfirmingblockGroupLinkRequests = 'ConfirmingblockGroupLinkRequests', | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  | type GroupIconType = | 
					
						
							|  |  |  |   | 'group' | 
					
						
							|  |  |  |   | 'group-access' | 
					
						
							|  |  |  |   | 'group-add' | 
					
						
							|  |  |  |   | 'group-approved' | 
					
						
							|  |  |  |   | 'group-avatar' | 
					
						
							|  |  |  |   | 'group-decline' | 
					
						
							|  |  |  |   | 'group-edit' | 
					
						
							| 
									
										
										
										
											2022-12-06 13:12:57 -08:00
										 |  |  |   | 'group-summary' | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   | 'group-leave' | 
					
						
							|  |  |  |   | 'group-remove'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const changeToIconMap = new Map<string, GroupIconType>([ | 
					
						
							|  |  |  |   ['access-attributes', 'group-access'], | 
					
						
							|  |  |  |   ['access-invite-link', 'group-access'], | 
					
						
							|  |  |  |   ['access-members', 'group-access'], | 
					
						
							|  |  |  |   ['admin-approval-add-one', 'group-add'], | 
					
						
							|  |  |  |   ['admin-approval-remove-one', 'group-decline'], | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   ['admin-approval-bounce', 'group-decline'], | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   ['announcements-only', 'group-access'], | 
					
						
							|  |  |  |   ['avatar', 'group-avatar'], | 
					
						
							|  |  |  |   ['description', 'group-edit'], | 
					
						
							|  |  |  |   ['group-link-add', 'group-access'], | 
					
						
							|  |  |  |   ['group-link-remove', 'group-access'], | 
					
						
							|  |  |  |   ['group-link-reset', 'group-access'], | 
					
						
							|  |  |  |   ['member-add', 'group-add'], | 
					
						
							|  |  |  |   ['member-add-from-admin-approval', 'group-approved'], | 
					
						
							|  |  |  |   ['member-add-from-invite', 'group-add'], | 
					
						
							|  |  |  |   ['member-add-from-link', 'group-add'], | 
					
						
							|  |  |  |   ['member-privilege', 'group-access'], | 
					
						
							|  |  |  |   ['member-remove', 'group-remove'], | 
					
						
							|  |  |  |   ['pending-add-many', 'group-add'], | 
					
						
							|  |  |  |   ['pending-add-one', 'group-add'], | 
					
						
							|  |  |  |   ['pending-remove-many', 'group-decline'], | 
					
						
							|  |  |  |   ['pending-remove-one', 'group-decline'], | 
					
						
							|  |  |  |   ['title', 'group-edit'], | 
					
						
							|  |  |  | ]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function getIcon( | 
					
						
							|  |  |  |   detail: GroupV2ChangeDetailType, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   isLastText = true, | 
					
						
							| 
									
										
										
										
											2021-10-26 15:59:08 -07:00
										 |  |  |   fromId?: UUIDStringType | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  | ): GroupIconType { | 
					
						
							|  |  |  |   const changeType = detail.type; | 
					
						
							|  |  |  |   let possibleIcon = changeToIconMap.get(changeType); | 
					
						
							| 
									
										
										
										
											2021-10-26 15:59:08 -07:00
										 |  |  |   const isSameId = fromId === get(detail, 'uuid', null); | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   if (isSameId) { | 
					
						
							|  |  |  |     if (changeType === 'member-remove') { | 
					
						
							|  |  |  |       possibleIcon = 'group-leave'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (changeType === 'member-add-from-invite') { | 
					
						
							|  |  |  |       possibleIcon = 'group-approved'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   // Use default icon for "... requested to join via group link" added to
 | 
					
						
							|  |  |  |   // bounce notification.
 | 
					
						
							|  |  |  |   if (changeType === 'admin-approval-bounce' && isLastText) { | 
					
						
							|  |  |  |     possibleIcon = undefined; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-12-06 13:12:57 -08:00
										 |  |  |   if (changeType === 'summary') { | 
					
						
							|  |  |  |     possibleIcon = 'group-summary'; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   return possibleIcon || 'group'; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  | function GroupV2Detail({ | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   areWeAdmin, | 
					
						
							|  |  |  |   blockGroupLinkRequests, | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |   conversationId, | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   detail, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   isLastText, | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   fromId, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   groupMemberships, | 
					
						
							|  |  |  |   groupBannedMemberships, | 
					
						
							|  |  |  |   groupName, | 
					
						
							|  |  |  |   i18n, | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |   ourACI, | 
					
						
							|  |  |  |   ourPNI, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   renderContact, | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   text, | 
					
						
							|  |  |  | }: { | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   areWeAdmin: boolean; | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |   blockGroupLinkRequests: ( | 
					
						
							|  |  |  |     conversationId: string, | 
					
						
							|  |  |  |     uuid: UUIDStringType | 
					
						
							|  |  |  |   ) => unknown; | 
					
						
							|  |  |  |   conversationId: string; | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   detail: GroupV2ChangeDetailType; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   isLastText: boolean; | 
					
						
							| 
									
										
										
										
											2022-12-21 16:07:02 -08:00
										 |  |  |   groupMemberships?: ReadonlyArray<{ | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |     uuid: UUIDStringType; | 
					
						
							|  |  |  |     isAdmin: boolean; | 
					
						
							|  |  |  |   }>; | 
					
						
							| 
									
										
										
										
											2022-12-21 16:07:02 -08:00
										 |  |  |   groupBannedMemberships?: ReadonlyArray<UUIDStringType>; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   groupName?: string; | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   i18n: LocalizerType; | 
					
						
							| 
									
										
										
										
											2021-10-26 15:59:08 -07:00
										 |  |  |   fromId?: UUIDStringType; | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |   ourACI?: UUIDStringType; | 
					
						
							|  |  |  |   ourPNI?: UUIDStringType; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   renderContact: SmartContactRendererType<FullJSXType>; | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   text: FullJSXType; | 
					
						
							|  |  |  | }): JSX.Element { | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   const icon = getIcon(detail, isLastText, fromId); | 
					
						
							|  |  |  |   let buttonNode: ReactNode; | 
					
						
							| 
									
										
										
										
											2021-06-04 09:27:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   const [modalState, setModalState] = useState<ModalState>(ModalState.None); | 
					
						
							|  |  |  |   let modalNode: ReactNode; | 
					
						
							| 
									
										
										
										
											2021-06-04 09:27:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   switch (modalState) { | 
					
						
							|  |  |  |     case ModalState.None: | 
					
						
							|  |  |  |       modalNode = undefined; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case ModalState.ViewingGroupDescription: | 
					
						
							|  |  |  |       if (detail.type !== 'description' || !detail.description) { | 
					
						
							|  |  |  |         log.warn( | 
					
						
							|  |  |  |           'GroupV2Detail: ViewingGroupDescription but missing description or wrong change type' | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         modalNode = undefined; | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       modalNode = ( | 
					
						
							|  |  |  |         <Modal | 
					
						
							| 
									
										
										
										
											2022-09-27 13:24:21 -07:00
										 |  |  |           modalName="GroupV2Change.ViewingGroupDescription" | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |           hasXButton | 
					
						
							|  |  |  |           i18n={i18n} | 
					
						
							|  |  |  |           title={groupName} | 
					
						
							|  |  |  |           onClose={() => setModalState(ModalState.None)} | 
					
						
							|  |  |  |         > | 
					
						
							|  |  |  |           <GroupDescriptionText text={detail.description} /> | 
					
						
							|  |  |  |         </Modal> | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case ModalState.ConfirmingblockGroupLinkRequests: | 
					
						
							|  |  |  |       if ( | 
					
						
							|  |  |  |         !isLastText || | 
					
						
							|  |  |  |         detail.type !== 'admin-approval-bounce' || | 
					
						
							|  |  |  |         !detail.uuid | 
					
						
							|  |  |  |       ) { | 
					
						
							|  |  |  |         log.warn( | 
					
						
							|  |  |  |           'GroupV2Detail: ConfirmingblockGroupLinkRequests but missing uuid or wrong change type' | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         modalNode = undefined; | 
					
						
							|  |  |  |         break; | 
					
						
							| 
									
										
										
										
											2021-09-07 14:55:03 -05:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       modalNode = ( | 
					
						
							|  |  |  |         <ConfirmationDialog | 
					
						
							| 
									
										
										
										
											2022-09-27 13:24:21 -07:00
										 |  |  |           dialogName="GroupV2Change.confirmBlockLinkRequests" | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |           title={i18n('PendingRequests--block--title')} | 
					
						
							|  |  |  |           actions={[ | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |               action: () => blockGroupLinkRequests(conversationId, detail.uuid), | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |               text: i18n('PendingRequests--block--confirm'), | 
					
						
							| 
									
										
										
										
											2022-03-23 15:34:51 -07:00
										 |  |  |               style: 'affirmative', | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |             }, | 
					
						
							|  |  |  |           ]} | 
					
						
							|  |  |  |           i18n={i18n} | 
					
						
							|  |  |  |           onClose={() => setModalState(ModalState.None)} | 
					
						
							|  |  |  |         > | 
					
						
							|  |  |  |           <Intl | 
					
						
							|  |  |  |             id="PendingRequests--block--contents" | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             components={{ | 
					
						
							|  |  |  |               name: renderContact(detail.uuid), | 
					
						
							|  |  |  |             }} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         </ConfirmationDialog> | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     default: { | 
					
						
							|  |  |  |       const state: never = modalState; | 
					
						
							|  |  |  |       log.warn(`GroupV2Detail: unexpected modal state ${state}`); | 
					
						
							|  |  |  |       modalNode = undefined; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (detail.type === 'description' && detail.description) { | 
					
						
							|  |  |  |     buttonNode = ( | 
					
						
							|  |  |  |       <Button | 
					
						
							|  |  |  |         onClick={() => setModalState(ModalState.ViewingGroupDescription)} | 
					
						
							|  |  |  |         size={ButtonSize.Small} | 
					
						
							|  |  |  |         variant={ButtonVariant.SystemMessage} | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         {i18n('view')} | 
					
						
							|  |  |  |       </Button> | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } else if ( | 
					
						
							|  |  |  |     isLastText && | 
					
						
							|  |  |  |     detail.type === 'admin-approval-bounce' && | 
					
						
							|  |  |  |     areWeAdmin && | 
					
						
							|  |  |  |     detail.uuid && | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |     detail.uuid !== ourACI && | 
					
						
							|  |  |  |     detail.uuid !== ourPNI && | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |     (!fromId || fromId === detail.uuid) && | 
					
						
							|  |  |  |     !groupMemberships?.some(item => item.uuid === detail.uuid) && | 
					
						
							|  |  |  |     !groupBannedMemberships?.some(uuid => uuid === detail.uuid) | 
					
						
							|  |  |  |   ) { | 
					
						
							|  |  |  |     buttonNode = ( | 
					
						
							|  |  |  |       <Button | 
					
						
							|  |  |  |         onClick={() => | 
					
						
							|  |  |  |           setModalState(ModalState.ConfirmingblockGroupLinkRequests) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         size={ButtonSize.Small} | 
					
						
							|  |  |  |         variant={ButtonVariant.SystemMessage} | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         {i18n('PendingRequests--block--button')} | 
					
						
							|  |  |  |       </Button> | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ( | 
					
						
							|  |  |  |     <> | 
					
						
							|  |  |  |       <SystemMessage icon={icon} contents={text} button={buttonNode} /> | 
					
						
							|  |  |  |       {modalNode} | 
					
						
							|  |  |  |     </> | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |   ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function GroupV2Change(props: PropsType): ReactElement { | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   const { | 
					
						
							|  |  |  |     areWeAdmin, | 
					
						
							|  |  |  |     blockGroupLinkRequests, | 
					
						
							|  |  |  |     change, | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |     conversationId, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |     groupBannedMemberships, | 
					
						
							|  |  |  |     groupMemberships, | 
					
						
							|  |  |  |     groupName, | 
					
						
							|  |  |  |     i18n, | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |     ourACI, | 
					
						
							|  |  |  |     ourPNI, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |     renderContact, | 
					
						
							|  |  |  |   } = props; | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return ( | 
					
						
							|  |  |  |     <> | 
					
						
							| 
									
										
										
										
											2021-12-16 09:44:54 -08:00
										 |  |  |       {renderChange<FullJSXType>(change, { | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |         i18n, | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |         ourACI, | 
					
						
							|  |  |  |         ourPNI, | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |         renderContact, | 
					
						
							|  |  |  |         renderString: renderStringToIntl, | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |       }).map(({ detail, isLastText, text }, index) => { | 
					
						
							|  |  |  |         return ( | 
					
						
							|  |  |  |           <GroupV2Detail | 
					
						
							|  |  |  |             areWeAdmin={areWeAdmin} | 
					
						
							|  |  |  |             blockGroupLinkRequests={blockGroupLinkRequests} | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |             conversationId={conversationId} | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |             detail={detail} | 
					
						
							|  |  |  |             isLastText={isLastText} | 
					
						
							|  |  |  |             fromId={change.from} | 
					
						
							|  |  |  |             groupBannedMemberships={groupBannedMemberships} | 
					
						
							|  |  |  |             groupMemberships={groupMemberships} | 
					
						
							|  |  |  |             groupName={groupName} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             // Difficult to find a unique key for this type
 | 
					
						
							|  |  |  |             // eslint-disable-next-line react/no-array-index-key
 | 
					
						
							|  |  |  |             key={index} | 
					
						
							| 
									
										
										
										
											2022-07-08 13:46:25 -07:00
										 |  |  |             ourACI={ourACI} | 
					
						
							|  |  |  |             ourPNI={ourPNI} | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |             renderContact={renderContact} | 
					
						
							|  |  |  |             text={text} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       })} | 
					
						
							| 
									
										
										
										
											2021-08-26 16:51:55 -04:00
										 |  |  |     </> | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  |   ); | 
					
						
							|  |  |  | } |