| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | // Copyright 2021 Signal Messenger, LLC
 | 
					
						
							|  |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | import type { ReactChild, ReactNode } from 'react'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import React, { useState } from 'react'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | import { concat, orderBy } from 'lodash'; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-30 04:07:24 -06:00
										 |  |  | import type { LocalizerType, ThemeType } from '../../types/Util'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { ConversationType } from '../../state/ducks/conversations'; | 
					
						
							| 
									
										
										
										
											2021-11-30 04:07:24 -06:00
										 |  |  | import type { PreferredBadgeSelectorType } from '../../state/selectors/badges'; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | import { | 
					
						
							|  |  |  |   MessageRequestActionsConfirmation, | 
					
						
							|  |  |  |   MessageRequestState, | 
					
						
							|  |  |  | } from './MessageRequestActionsConfirmation'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | import { ContactSpoofingType } from '../../util/contactSpoofing'; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | import { Modal } from '../Modal'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | import { RemoveGroupMemberConfirmationDialog } from './RemoveGroupMemberConfirmationDialog'; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | import { ContactSpoofingReviewDialogPerson } from './ContactSpoofingReviewDialogPerson'; | 
					
						
							|  |  |  | import { Button, ButtonVariant } from '../Button'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | import { Intl } from '../Intl'; | 
					
						
							|  |  |  | import { Emojify } from './Emojify'; | 
					
						
							| 
									
										
										
										
											2022-09-15 12:17:15 -07:00
										 |  |  | import { assertDev } from '../../util/assert'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | import { missingCaseError } from '../../util/missingCaseError'; | 
					
						
							| 
									
										
										
										
											2021-06-02 12:24:22 -05:00
										 |  |  | import { isInSystemContacts } from '../../util/isInSystemContacts'; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-24 14:46:17 -07:00
										 |  |  | export type PropsType = { | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |   conversationId: string; | 
					
						
							| 
									
										
										
										
											2022-12-06 14:03:09 -05:00
										 |  |  |   acceptConversation: (conversationId: string) => unknown; | 
					
						
							|  |  |  |   blockAndReportSpam: (conversationId: string) => unknown; | 
					
						
							|  |  |  |   blockConversation: (conversationId: string) => unknown; | 
					
						
							|  |  |  |   deleteConversation: (conversationId: string) => unknown; | 
					
						
							| 
									
										
										
										
											2021-11-30 04:07:24 -06:00
										 |  |  |   getPreferredBadge: PreferredBadgeSelectorType; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  |   i18n: LocalizerType; | 
					
						
							|  |  |  |   onClose: () => void; | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |   showContactModal: (contactId: string, conversationId?: string) => unknown; | 
					
						
							|  |  |  |   removeMember: ( | 
					
						
							|  |  |  |     conversationId: string, | 
					
						
							|  |  |  |     memberConversationId: string | 
					
						
							|  |  |  |   ) => unknown; | 
					
						
							| 
									
										
										
										
											2021-11-30 04:07:24 -06:00
										 |  |  |   theme: ThemeType; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | } & ( | 
					
						
							|  |  |  |   | { | 
					
						
							|  |  |  |       type: ContactSpoofingType.DirectConversationWithSameTitle; | 
					
						
							|  |  |  |       possiblyUnsafeConversation: ConversationType; | 
					
						
							|  |  |  |       safeConversation: ConversationType; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   | { | 
					
						
							|  |  |  |       type: ContactSpoofingType.MultipleGroupMembersWithSameTitle; | 
					
						
							| 
									
										
										
										
											2022-03-14 18:32:07 -07:00
										 |  |  |       group: ConversationType; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |       collisionInfoByTitle: Record< | 
					
						
							|  |  |  |         string, | 
					
						
							|  |  |  |         Array<{ | 
					
						
							|  |  |  |           oldName?: string; | 
					
						
							|  |  |  |           conversation: ConversationType; | 
					
						
							|  |  |  |         }> | 
					
						
							|  |  |  |       >; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | enum ConfirmationStateType { | 
					
						
							|  |  |  |   ConfirmingDelete, | 
					
						
							|  |  |  |   ConfirmingBlock, | 
					
						
							|  |  |  |   ConfirmingGroupRemoval, | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function ContactSpoofingReviewDialog(props: PropsType): JSX.Element { | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   const { | 
					
						
							| 
									
										
										
										
											2022-12-06 14:03:09 -05:00
										 |  |  |     acceptConversation, | 
					
						
							|  |  |  |     blockAndReportSpam, | 
					
						
							|  |  |  |     blockConversation, | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |     conversationId, | 
					
						
							| 
									
										
										
										
											2022-12-06 14:03:09 -05:00
										 |  |  |     deleteConversation, | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |     getPreferredBadge, | 
					
						
							|  |  |  |     i18n, | 
					
						
							|  |  |  |     onClose, | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |     showContactModal, | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |     removeMember, | 
					
						
							|  |  |  |     theme, | 
					
						
							|  |  |  |   } = props; | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   const [confirmationState, setConfirmationState] = useState< | 
					
						
							|  |  |  |     | undefined | 
					
						
							|  |  |  |     | { | 
					
						
							|  |  |  |         type: ConfirmationStateType.ConfirmingGroupRemoval; | 
					
						
							|  |  |  |         affectedConversation: ConversationType; | 
					
						
							|  |  |  |         group: ConversationType; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     | { | 
					
						
							|  |  |  |         type: | 
					
						
							|  |  |  |           | ConfirmationStateType.ConfirmingDelete | 
					
						
							|  |  |  |           | ConfirmationStateType.ConfirmingBlock; | 
					
						
							|  |  |  |         affectedConversation: ConversationType; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |   >(); | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   if (confirmationState) { | 
					
						
							|  |  |  |     const { type, affectedConversation } = confirmationState; | 
					
						
							|  |  |  |     switch (type) { | 
					
						
							|  |  |  |       case ConfirmationStateType.ConfirmingDelete: | 
					
						
							|  |  |  |       case ConfirmationStateType.ConfirmingBlock: | 
					
						
							|  |  |  |         return ( | 
					
						
							|  |  |  |           <MessageRequestActionsConfirmation | 
					
						
							| 
									
										
										
										
											2022-12-06 14:03:09 -05:00
										 |  |  |             acceptConversation={acceptConversation} | 
					
						
							|  |  |  |             blockAndReportSpam={blockAndReportSpam} | 
					
						
							|  |  |  |             blockConversation={blockConversation} | 
					
						
							|  |  |  |             conversationId={affectedConversation.id} | 
					
						
							|  |  |  |             conversationType="direct" | 
					
						
							|  |  |  |             deleteConversation={deleteConversation} | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             title={affectedConversation.title} | 
					
						
							|  |  |  |             state={ | 
					
						
							|  |  |  |               type === ConfirmationStateType.ConfirmingDelete | 
					
						
							|  |  |  |                 ? MessageRequestState.deleting | 
					
						
							|  |  |  |                 : MessageRequestState.blocking | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             onChangeState={messageRequestState => { | 
					
						
							|  |  |  |               switch (messageRequestState) { | 
					
						
							|  |  |  |                 case MessageRequestState.blocking: | 
					
						
							|  |  |  |                   setConfirmationState({ | 
					
						
							|  |  |  |                     type: ConfirmationStateType.ConfirmingBlock, | 
					
						
							|  |  |  |                     affectedConversation, | 
					
						
							|  |  |  |                   }); | 
					
						
							|  |  |  |                   break; | 
					
						
							|  |  |  |                 case MessageRequestState.deleting: | 
					
						
							|  |  |  |                   setConfirmationState({ | 
					
						
							|  |  |  |                     type: ConfirmationStateType.ConfirmingDelete, | 
					
						
							|  |  |  |                     affectedConversation, | 
					
						
							|  |  |  |                   }); | 
					
						
							|  |  |  |                   break; | 
					
						
							|  |  |  |                 case MessageRequestState.unblocking: | 
					
						
							| 
									
										
										
										
											2022-09-15 12:17:15 -07:00
										 |  |  |                   assertDev( | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                     false, | 
					
						
							|  |  |  |                     'Got unexpected MessageRequestState.unblocking state. Clearing confiration state' | 
					
						
							|  |  |  |                   ); | 
					
						
							|  |  |  |                   setConfirmationState(undefined); | 
					
						
							|  |  |  |                   break; | 
					
						
							|  |  |  |                 case MessageRequestState.default: | 
					
						
							|  |  |  |                   setConfirmationState(undefined); | 
					
						
							|  |  |  |                   break; | 
					
						
							|  |  |  |                 default: | 
					
						
							|  |  |  |                   throw missingCaseError(messageRequestState); | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |             }} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       case ConfirmationStateType.ConfirmingGroupRemoval: { | 
					
						
							|  |  |  |         const { group } = confirmationState; | 
					
						
							|  |  |  |         return ( | 
					
						
							|  |  |  |           <RemoveGroupMemberConfirmationDialog | 
					
						
							|  |  |  |             conversation={affectedConversation} | 
					
						
							|  |  |  |             group={group} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             onClose={() => { | 
					
						
							|  |  |  |               setConfirmationState(undefined); | 
					
						
							|  |  |  |             }} | 
					
						
							|  |  |  |             onRemove={() => { | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |               removeMember(conversationId, affectedConversation.id); | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |             }} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2021-11-11 16:43:05 -06:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |       default: | 
					
						
							|  |  |  |         throw missingCaseError(type); | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   let title: string; | 
					
						
							|  |  |  |   let contents: ReactChild; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   switch (props.type) { | 
					
						
							|  |  |  |     case ContactSpoofingType.DirectConversationWithSameTitle: { | 
					
						
							|  |  |  |       const { possiblyUnsafeConversation, safeConversation } = props; | 
					
						
							| 
									
										
										
										
											2022-09-15 12:17:15 -07:00
										 |  |  |       assertDev( | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |         possiblyUnsafeConversation.type === 'direct', | 
					
						
							|  |  |  |         '<ContactSpoofingReviewDialog> expected a direct conversation for the "possibly unsafe" conversation' | 
					
						
							|  |  |  |       ); | 
					
						
							| 
									
										
										
										
											2022-09-15 12:17:15 -07:00
										 |  |  |       assertDev( | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |         safeConversation.type === 'direct', | 
					
						
							|  |  |  |         '<ContactSpoofingReviewDialog> expected a direct conversation for the "safe" conversation' | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       title = i18n('ContactSpoofingReviewDialog__title'); | 
					
						
							|  |  |  |       contents = ( | 
					
						
							|  |  |  |         <> | 
					
						
							|  |  |  |           <p>{i18n('ContactSpoofingReviewDialog__description')}</p> | 
					
						
							|  |  |  |           <h2>{i18n('ContactSpoofingReviewDialog__possibly-unsafe-title')}</h2> | 
					
						
							|  |  |  |           <ContactSpoofingReviewDialogPerson | 
					
						
							|  |  |  |             conversation={possiblyUnsafeConversation} | 
					
						
							|  |  |  |             getPreferredBadge={getPreferredBadge} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             theme={theme} | 
					
						
							|  |  |  |           > | 
					
						
							|  |  |  |             <div className="module-ContactSpoofingReviewDialog__buttons"> | 
					
						
							|  |  |  |               <Button | 
					
						
							|  |  |  |                 variant={ButtonVariant.SecondaryDestructive} | 
					
						
							|  |  |  |                 onClick={() => { | 
					
						
							|  |  |  |                   setConfirmationState({ | 
					
						
							|  |  |  |                     type: ConfirmationStateType.ConfirmingDelete, | 
					
						
							|  |  |  |                     affectedConversation: possiblyUnsafeConversation, | 
					
						
							|  |  |  |                   }); | 
					
						
							|  |  |  |                 }} | 
					
						
							|  |  |  |               > | 
					
						
							|  |  |  |                 {i18n('MessageRequests--delete')} | 
					
						
							|  |  |  |               </Button> | 
					
						
							|  |  |  |               <Button | 
					
						
							|  |  |  |                 variant={ButtonVariant.SecondaryDestructive} | 
					
						
							|  |  |  |                 onClick={() => { | 
					
						
							|  |  |  |                   setConfirmationState({ | 
					
						
							|  |  |  |                     type: ConfirmationStateType.ConfirmingBlock, | 
					
						
							|  |  |  |                     affectedConversation: possiblyUnsafeConversation, | 
					
						
							|  |  |  |                   }); | 
					
						
							|  |  |  |                 }} | 
					
						
							|  |  |  |               > | 
					
						
							|  |  |  |                 {i18n('MessageRequests--block')} | 
					
						
							|  |  |  |               </Button> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |           </ContactSpoofingReviewDialogPerson> | 
					
						
							|  |  |  |           <hr /> | 
					
						
							|  |  |  |           <h2>{i18n('ContactSpoofingReviewDialog__safe-title')}</h2> | 
					
						
							|  |  |  |           <ContactSpoofingReviewDialogPerson | 
					
						
							|  |  |  |             conversation={safeConversation} | 
					
						
							|  |  |  |             getPreferredBadge={getPreferredBadge} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             onClick={() => { | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  |               showContactModal(safeConversation.id); | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |             }} | 
					
						
							|  |  |  |             theme={theme} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         </> | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case ContactSpoofingType.MultipleGroupMembersWithSameTitle: { | 
					
						
							|  |  |  |       const { group, collisionInfoByTitle } = props; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |       const unsortedConversationInfos = concat( | 
					
						
							|  |  |  |         // This empty array exists to appease Lodash's type definitions.
 | 
					
						
							|  |  |  |         [], | 
					
						
							|  |  |  |         ...Object.values(collisionInfoByTitle) | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       const conversationInfos = orderBy(unsortedConversationInfos, [ | 
					
						
							|  |  |  |         // We normally use an `Intl.Collator` to sort by title. We do this instead, as
 | 
					
						
							|  |  |  |         //   we only really care about stability (not perfect ordering).
 | 
					
						
							|  |  |  |         'title', | 
					
						
							|  |  |  |         'id', | 
					
						
							|  |  |  |       ]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       title = i18n('ContactSpoofingReviewDialog__group__title'); | 
					
						
							|  |  |  |       contents = ( | 
					
						
							|  |  |  |         <> | 
					
						
							|  |  |  |           <p> | 
					
						
							|  |  |  |             {i18n('ContactSpoofingReviewDialog__group__description', [ | 
					
						
							|  |  |  |               conversationInfos.length.toString(), | 
					
						
							|  |  |  |             ])} | 
					
						
							|  |  |  |           </p> | 
					
						
							|  |  |  |           <h2>{i18n('ContactSpoofingReviewDialog__group__members-header')}</h2> | 
					
						
							|  |  |  |           {conversationInfos.map((conversationInfo, index) => { | 
					
						
							|  |  |  |             let button: ReactNode; | 
					
						
							|  |  |  |             if (group.areWeAdmin) { | 
					
						
							|  |  |  |               button = ( | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |                 <Button | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                   variant={ButtonVariant.SecondaryAffirmative} | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |                   onClick={() => { | 
					
						
							|  |  |  |                     setConfirmationState({ | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                       type: ConfirmationStateType.ConfirmingGroupRemoval, | 
					
						
							|  |  |  |                       affectedConversation: conversationInfo.conversation, | 
					
						
							|  |  |  |                       group, | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |                     }); | 
					
						
							|  |  |  |                   }} | 
					
						
							|  |  |  |                 > | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                   {i18n('RemoveGroupMemberConfirmation__remove-button')} | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |                 </Button> | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |               ); | 
					
						
							|  |  |  |             } else if (conversationInfo.conversation.isBlocked) { | 
					
						
							|  |  |  |               button = ( | 
					
						
							|  |  |  |                 <Button | 
					
						
							|  |  |  |                   variant={ButtonVariant.SecondaryAffirmative} | 
					
						
							|  |  |  |                   onClick={() => { | 
					
						
							| 
									
										
										
										
											2022-12-06 14:03:09 -05:00
										 |  |  |                     acceptConversation(conversationInfo.conversation.id); | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                   }} | 
					
						
							|  |  |  |                 > | 
					
						
							|  |  |  |                   {i18n('MessageRequests--unblock')} | 
					
						
							|  |  |  |                 </Button> | 
					
						
							|  |  |  |               ); | 
					
						
							|  |  |  |             } else if (!isInSystemContacts(conversationInfo.conversation)) { | 
					
						
							|  |  |  |               button = ( | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |                 <Button | 
					
						
							|  |  |  |                   variant={ButtonVariant.SecondaryDestructive} | 
					
						
							|  |  |  |                   onClick={() => { | 
					
						
							|  |  |  |                     setConfirmationState({ | 
					
						
							|  |  |  |                       type: ConfirmationStateType.ConfirmingBlock, | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                       affectedConversation: conversationInfo.conversation, | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |                     }); | 
					
						
							|  |  |  |                   }} | 
					
						
							|  |  |  |                 > | 
					
						
							|  |  |  |                   {i18n('MessageRequests--block')} | 
					
						
							|  |  |  |                 </Button> | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |               ); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2021-11-11 16:43:05 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |             const { oldName } = conversationInfo; | 
					
						
							|  |  |  |             const newName = | 
					
						
							|  |  |  |               conversationInfo.conversation.profileName || | 
					
						
							|  |  |  |               conversationInfo.conversation.title; | 
					
						
							| 
									
										
										
										
											2021-11-11 16:43:05 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-09 20:59:36 -08:00
										 |  |  |             let callout: JSX.Element | undefined; | 
					
						
							|  |  |  |             if (oldName && oldName !== newName) { | 
					
						
							|  |  |  |               callout = ( | 
					
						
							|  |  |  |                 <div className="module-ContactSpoofingReviewDialogPerson__info__property module-ContactSpoofingReviewDialogPerson__info__property--callout"> | 
					
						
							|  |  |  |                   <Intl | 
					
						
							|  |  |  |                     i18n={i18n} | 
					
						
							|  |  |  |                     id="ContactSpoofingReviewDialog__group__name-change-info" | 
					
						
							|  |  |  |                     components={{ | 
					
						
							|  |  |  |                       oldName: <Emojify text={oldName} />, | 
					
						
							|  |  |  |                       newName: <Emojify text={newName} />, | 
					
						
							|  |  |  |                     }} | 
					
						
							|  |  |  |                   /> | 
					
						
							|  |  |  |                 </div> | 
					
						
							|  |  |  |               ); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |             return ( | 
					
						
							|  |  |  |               <> | 
					
						
							|  |  |  |                 {index !== 0 && <hr />} | 
					
						
							|  |  |  |                 <ContactSpoofingReviewDialogPerson | 
					
						
							|  |  |  |                   key={conversationInfo.conversation.id} | 
					
						
							|  |  |  |                   conversation={conversationInfo.conversation} | 
					
						
							|  |  |  |                   getPreferredBadge={getPreferredBadge} | 
					
						
							|  |  |  |                   i18n={i18n} | 
					
						
							|  |  |  |                   theme={theme} | 
					
						
							|  |  |  |                 > | 
					
						
							| 
									
										
										
										
											2022-11-09 20:59:36 -08:00
										 |  |  |                   {callout} | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |                   {button && ( | 
					
						
							|  |  |  |                     <div className="module-ContactSpoofingReviewDialog__buttons"> | 
					
						
							|  |  |  |                       {button} | 
					
						
							|  |  |  |                     </div> | 
					
						
							|  |  |  |                   )} | 
					
						
							|  |  |  |                 </ContactSpoofingReviewDialogPerson> | 
					
						
							|  |  |  |               </> | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  |           })} | 
					
						
							|  |  |  |         </> | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       break; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |     default: | 
					
						
							|  |  |  |       throw missingCaseError(props); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-04-21 11:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   return ( | 
					
						
							|  |  |  |     <Modal | 
					
						
							| 
									
										
										
										
											2022-09-27 13:24:21 -07:00
										 |  |  |       modalName="ContactSpoofingReviewDialog" | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |       hasXButton | 
					
						
							|  |  |  |       i18n={i18n} | 
					
						
							|  |  |  |       moduleClassName="module-ContactSpoofingReviewDialog" | 
					
						
							|  |  |  |       onClose={onClose} | 
					
						
							|  |  |  |       title={title} | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       {contents} | 
					
						
							|  |  |  |     </Modal> | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } |