Skip to content

Commit

Permalink
change type location, resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
waterim committed Mar 26, 2024
1 parent fc683cb commit 24cf044
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
'',
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatConfirmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/pages/NewChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
7 changes: 5 additions & 2 deletions src/types/onyx/NewGroupChatDraft.ts
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 24cf044

Please sign in to comment.