diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 179ee87862ff..f3fefa4850a7 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -70,16 +70,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/NewRoomForm'; -import type { - NewGroupChatDraft, - PersonalDetails, - PersonalDetailsList, - PolicyReportField, - RecentlyUsedReportFields, - ReportActionReactions, - ReportMetadata, - ReportUserIsTyping, -} from '@src/types/onyx'; +import type {PersonalDetails, PersonalDetailsList, PolicyReportField, RecentlyUsedReportFields, ReportActionReactions, ReportMetadata, ReportUserIsTyping} from '@src/types/onyx'; import type {Decision, OriginalMessageIOU} from '@src/types/onyx/OriginalMessage'; import type {NotificationPreference, RoomVisibility, WriteCapability} from '@src/types/onyx/Report'; import type Report from '@src/types/onyx/Report'; @@ -212,12 +203,6 @@ Onyx.connect({ callback: (val) => (allRecentlyUsedReportFields = val), }); -let newGroupDraft: OnyxEntry<NewGroupChatDraft>; -Onyx.connect({ - key: ONYXKEYS.NEW_GROUP_CHAT_DRAFT, - callback: (value) => (newGroupDraft = value), -}); - function clearGroupChat() { Onyx.set(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, null); } @@ -799,14 +784,15 @@ function navigateToAndOpenReport(userLogins: string[], shouldDismissModal = true let newChat: ReportUtils.OptimisticChatReport | EmptyObject = {}; let chat: OnyxEntry<Report> | EmptyObject = {}; const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins(userLogins); + const isGroupChat = participantAccountIDs.length > 1; // If we are not creating a new Group Chat then we are creating a 1:1 DM and will look for an existing chat - if (!newGroupDraft) { + if (!isGroupChat) { chat = ReportUtils.getChatByParticipants(participantAccountIDs); } if (isEmptyObject(chat)) { - if (newGroupDraft) { + if (isGroupChat) { newChat = ReportUtils.buildOptimisticChatReport( participantAccountIDs, reportName,