diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 56d90b0208d1..b1117ba09865 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -2286,9 +2286,8 @@ function createSplitsAndOnyxData( existingSplitChatReport = participants.length < 2 ? ReportUtils.getChatByParticipants(participantAccountIDs) : null; } let newChat: ReportUtils.OptimisticChatReport | EmptyObject = {}; - + const allParticipantsAccountIDs = [...participantAccountIDs, currentUserAccountID]; if (!existingSplitChatReport && participants.length > 1) { - const allParticipantsAccountIDs = [...participantAccountIDs, currentUserAccountID]; newChat = ReportUtils.buildOptimisticChatReport( allParticipantsAccountIDs, '', @@ -2303,7 +2302,7 @@ function createSplitsAndOnyxData( ); } if (isEmptyObject(newChat)) { - newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs); + newChat = ReportUtils.buildOptimisticChatReport(allParticipantsAccountIDs); } const splitChatReport = existingSplitChatReport ?? newChat; const isOwnPolicyExpenseChat = !!splitChatReport.isOwnPolicyExpenseChat; diff --git a/src/pages/NewChatConfirmPage.tsx b/src/pages/NewChatConfirmPage.tsx index 5330a3979d26..8570c061ebce 100644 --- a/src/pages/NewChatConfirmPage.tsx +++ b/src/pages/NewChatConfirmPage.tsx @@ -44,7 +44,7 @@ function NewChatConfirmPage({newGroupDraft, allPersonalDetails}: NewChatConfirmP if (!newGroupDraft?.participants) { return []; } - const options: Participant[] = newGroupDraft?.participants.map((participant) => + const options: Participant[] = newGroupDraft.participants.map((participant) => OptionsListUtils.getParticipantsOption({accountID: participant.accountID, login: participant.login, reportID: ''}, allPersonalDetails), ); return options; diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index cb4511657afd..59727945967d 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -26,11 +26,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; - -type SelectedParticipant = { - accountID: number; - login: string; -}; +import type {SelectedParticipant} from '@src/types/onyx/NewGroupChatDraft'; type NewChatPageWithOnyxProps = { /** All reports shared with the user */ diff --git a/src/types/onyx/NewGroupChatDraft.ts b/src/types/onyx/NewGroupChatDraft.ts index f2bc3e94a7ea..97dd63aa5f68 100644 --- a/src/types/onyx/NewGroupChatDraft.ts +++ b/src/types/onyx/NewGroupChatDraft.ts @@ -1,8 +1,11 @@ -import type {SelectedParticipant} from '@pages/NewChatPage'; +type SelectedParticipant = { + accountID: number; + login: string; +}; type NewGroupChatDraft = { participants: SelectedParticipant[]; reportName: string; }; - +export type {SelectedParticipant}; export default NewGroupChatDraft;