@@ -279,11 +279,8 @@ type OpenReportActionParams = {
279279 /** The ID used to fetch a specific range of report actions related to the current reportActionID when opening a chat */
280280 reportActionID ?: string ;
281281
282- /** The list of participants */
283- participants ?: ParticipantInfo [ ] ;
284-
285- /** The personal details of the participants */
286- personalDetails ?: OnyxEntry < PersonalDetailsList > ;
282+ /** The list of users that are included in a new chat, not including the user creating it */
283+ participantLoginList ?: string [ ] ;
287284
288285 /** The optimistic report object created when making a new chat, saved as optimistic data */
289286 newReportObject ?: OptimisticChatReport ;
@@ -294,6 +291,9 @@ type OpenReportActionParams = {
294291 /** Whether or not this report is being opened from a deep link */
295292 isFromDeepLink ?: boolean ;
296293
294+ /** The list of accountIDs that are included in a new chat, not including the user creating it */
295+ participantAccountIDList ?: number [ ] ;
296+
297297 /** Whether this is a new thread being created */
298298 isNewThread ?: boolean ;
299299
@@ -1188,11 +1188,6 @@ function clearAvatarErrors(reportID: string) {
11881188 } ) ;
11891189}
11901190
1191- type ParticipantInfo = {
1192- login : string ;
1193- accountID ?: number ;
1194- } ;
1195-
11961191type GuidedSetupOptimisticOnyxUpdate = OnyxUpdate <
11971192 typeof ONYXKEYS . COLLECTION . REPORT | typeof ONYXKEYS . COLLECTION . REPORT_ACTIONS | typeof ONYXKEYS . NVP_INTRO_SELECTED | typeof ONYXKEYS . NVP_ONBOARDING | typeof ONYXKEYS . COLLECTION . POLICY
11981193> ;
@@ -1217,13 +1212,6 @@ type GuidedSetupDataForOpenReport = {
12171212 guidedSetupData : string ;
12181213} ;
12191214
1220- function buildParticipantInfoFromLogins ( logins : string [ ] , accountIDs ?: number [ ] ) : ParticipantInfo [ ] {
1221- return logins . map ( ( login , index ) => ( {
1222- login,
1223- accountID : accountIDs ?. [ index ] ,
1224- } ) ) ;
1225- }
1226-
12271215/**
12281216 * Prepares guided setup data for an OpenReport request when onboarding is not yet completed.
12291217 * Returns the onyx data arrays and guidedSetupData string to include in the API parameters,
@@ -1302,11 +1290,11 @@ function openReport(params: OpenReportActionParams) {
13021290 reportID,
13031291 introSelected,
13041292 reportActionID,
1305- participants = [ ] ,
1293+ participantLoginList = [ ] ,
13061294 newReportObject,
13071295 parentReportActionID,
13081296 isFromDeepLink = false ,
1309- personalDetails ,
1297+ participantAccountIDList = [ ] ,
13101298 isNewThread = false ,
13111299 transaction,
13121300 transactionViolations,
@@ -1322,9 +1310,6 @@ function openReport(params: OpenReportActionParams) {
13221310 return ;
13231311 }
13241312
1325- const participantLoginList = participants . map ( ( p ) => p . login ) ;
1326- const participantAccountIDList = participants . map ( ( p ) => p . accountID ) . filter ( ( id ) : id is number => id !== undefined ) ;
1327-
13281313 const optimisticReport = reportActionsExist ( reportID )
13291314 ? { }
13301315 : {
@@ -1576,7 +1561,7 @@ function openReport(params: OpenReportActionParams) {
15761561
15771562 let emailCreatingAction : string = CONST . REPORT . OWNER_EMAIL_FAKE ;
15781563 if ( newReportObject . ownerAccountID && newReportObject . ownerAccountID !== CONST . REPORT . OWNER_ACCOUNT_ID_FAKE ) {
1579- emailCreatingAction = personalDetails ?. [ newReportObject . ownerAccountID ] ?. login ?? '' ;
1564+ emailCreatingAction = allPersonalDetails ?. [ newReportObject . ownerAccountID ] ?. login ?? '' ;
15801565 }
15811566 const optimisticCreatedAction = buildOptimisticCreatedReportAction ( emailCreatingAction ) ;
15821567 optimisticData . push (
@@ -1614,7 +1599,7 @@ function openReport(params: OpenReportActionParams) {
16141599 const participantAccountIDs = PersonalDetailsUtils . getAccountIDsByLogins ( participantLoginList ) ;
16151600 for ( const [ index , login ] of participantLoginList . entries ( ) ) {
16161601 const accountID = participantAccountIDs . at ( index ) ?? - 1 ;
1617- const isOptimisticAccount = ! personalDetails ?. [ accountID ] ;
1602+ const isOptimisticAccount = ! allPersonalDetails ?. [ accountID ] ;
16181603
16191604 if ( ! isOptimisticAccount ) {
16201605 continue ;
@@ -1981,8 +1966,7 @@ function createTransactionThreadReport(
19811966 openReport ( {
19821967 reportID : optimisticTransactionThreadReportID ,
19831968 introSelected,
1984- participants : currentUserLogin ? [ { login : currentUserLogin , accountID : currentUserAccountID } ] : [ ] ,
1985- personalDetails : allPersonalDetails ,
1969+ participantLoginList : currentUserLogin ? [ currentUserLogin ] : [ ] ,
19861970 newReportObject : optimisticTransactionThread ,
19871971 parentReportActionID : iouReportAction ?. reportActionID ,
19881972 transaction,
@@ -2031,7 +2015,6 @@ function navigateToReport(reportID: string | undefined, shouldDismissModal = tru
20312015 */
20322016function navigateToAndOpenReport (
20332017 userLogins : string [ ] ,
2034- personalDetails : OnyxEntry < PersonalDetailsList > ,
20352018 currentUserAccountID : number ,
20362019 introSelected : OnyxEntry < IntroSelected > ,
20372020 isSelfTourViewed : boolean | undefined ,
@@ -2047,10 +2030,8 @@ function navigateToAndOpenReport(
20472030 participantList : [ ...participantAccountIDs , currentUserAccountID ] ,
20482031 notificationPreference : CONST . REPORT . NOTIFICATION_PREFERENCE . HIDDEN ,
20492032 } ) ;
2050-
2051- const participants = buildParticipantInfoFromLogins ( userLogins , participantAccountIDs ) ;
20522033 // We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server
2053- openReport ( { reportID : newChat ?. reportID , introSelected, reportActionID : '' , participants , personalDetails , newReportObject : newChat , isSelfTourViewed, betas} ) ;
2034+ openReport ( { reportID : newChat ?. reportID , introSelected, reportActionID : '' , participantLoginList : userLogins , newReportObject : newChat , isSelfTourViewed, betas} ) ;
20542035 }
20552036 const report = isEmptyObject ( chat ) ? newChat : chat ;
20562037
@@ -2082,43 +2063,20 @@ function navigateToAndCreateGroupChat(
20822063 *
20832064 * @param participantAccountIDs of user logins to start a chat report with.
20842065 */
2085- function navigateToAndOpenReportWithAccountIDs (
2086- participantAccountIDs : number [ ] ,
2087- currentUserAccountID : number ,
2088- introSelected : OnyxEntry < IntroSelected > ,
2089- betas : OnyxEntry < Beta [ ] > ,
2090- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
2091- ) {
2066+ function navigateToAndOpenReportWithAccountIDs ( participantAccountIDs : number [ ] , currentUserAccountID : number , introSelected : OnyxEntry < IntroSelected > , betas : OnyxEntry < Beta [ ] > ) {
20922067 let newChat : OptimisticChatReport | undefined ;
20932068 const chat = getChatByParticipants ( [ ...participantAccountIDs , currentUserAccountID ] ) ;
20942069 if ( ! chat ) {
20952070 newChat = buildOptimisticChatReport ( {
20962071 participantList : [ ...participantAccountIDs , currentUserAccountID ] ,
20972072 } ) ;
2098-
2099- const detailsToUse = personalDetails ?? allPersonalDetails ;
2100-
2101- const participants = participantAccountIDs
2102- . map ( ( accountID ) : ParticipantInfo | null => {
2103- const personalDetail = detailsToUse ?. [ accountID ] ;
2104- if ( ! personalDetail ?. login ) {
2105- return null ;
2106- }
2107- return {
2108- login : personalDetail . login ,
2109- accountID,
2110- } ;
2111- } )
2112- . filter ( ( p ) : p is ParticipantInfo => p !== null ) ;
2113-
21142073 // We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server
21152074 openReport ( {
21162075 reportID : newChat ?. reportID ,
21172076 introSelected,
21182077 newReportObject : newChat ,
21192078 parentReportActionID : '0' ,
2120- participants,
2121- personalDetails : detailsToUse ,
2079+ participantAccountIDList : participantAccountIDs ,
21222080 betas,
21232081 } ) ;
21242082 }
@@ -2143,9 +2101,8 @@ function navigateToAndOpenChildReport(
21432101 currentUserAccountID : number ,
21442102 introSelected : OnyxEntry < IntroSelected > ,
21452103 betas : OnyxEntry < Beta [ ] > ,
2146- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
21472104) {
2148- const report = childReport ?? createChildReport ( childReport , parentReportAction , parentReport , currentUserAccountID , introSelected , betas , personalDetails ) ;
2105+ const report = childReport ?? createChildReport ( childReport , parentReportAction , parentReport , currentUserAccountID , introSelected , betas ) ;
21492106
21502107 Navigation . navigate ( ROUTES . REPORT_WITH_ID . getRoute ( report . reportID , undefined , undefined , Navigation . getActiveRoute ( ) ) ) ;
21512108}
@@ -2162,7 +2119,6 @@ function createChildReport(
21622119 currentUserAccountID : number ,
21632120 introSelected : OnyxEntry < IntroSelected > ,
21642121 betas : OnyxEntry < Beta [ ] > ,
2165- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
21662122) : Report {
21672123 const participantAccountIDs = [ ...new Set ( [ currentUserAccountID , Number ( parentReportAction . actorAccountID ) ] ) ] ;
21682124 // Threads from DMs and selfDMs don't have a chatType. All other threads inherit the chatType from their parent
@@ -2182,17 +2138,11 @@ function createChildReport(
21822138
21832139 const childReportID = childReport ?. reportID ?? parentReportAction . childReportID ;
21842140 if ( ! childReportID ) {
2185- const participantAccountIDsForDetails = Object . keys ( newChat . participants ?? { } ) . map ( Number ) ;
2186- const participantLogins = PersonalDetailsUtils . getLoginsByAccountIDs ( participantAccountIDsForDetails ) ;
2187-
2188- const detailsToUse = personalDetails ?? allPersonalDetails ;
2189-
2190- const participants = buildParticipantInfoFromLogins ( participantLogins , participantAccountIDsForDetails ) ;
2141+ const participantLogins = PersonalDetailsUtils . getLoginsByAccountIDs ( Object . keys ( newChat . participants ?? { } ) . map ( Number ) ) ;
21912142 openReport ( {
21922143 reportID : newChat . reportID ,
21932144 introSelected,
2194- participants,
2195- personalDetails : detailsToUse ,
2145+ participantLoginList : participantLogins ,
21962146 newReportObject : newChat ,
21972147 parentReportActionID : parentReportAction . reportActionID ,
21982148 isNewThread : true ,
@@ -3088,11 +3038,10 @@ function toggleSubscribeToChildReport(
30883038 } ) ;
30893039
30903040 const participantLogins = PersonalDetailsUtils . getLoginsByAccountIDs ( participantAccountIDs ) ;
3091- const participants = buildParticipantInfoFromLogins ( participantLogins , participantAccountIDs ) ;
30923041 openReport ( {
30933042 reportID : newChat . reportID ,
30943043 introSelected,
3095- participants ,
3044+ participantLoginList : participantLogins ,
30963045 newReportObject : newChat ,
30973046 parentReportActionID : parentReportAction . reportActionID ,
30983047 isSelfTourViewed,
@@ -3512,7 +3461,7 @@ function navigateToConciergeChat(
35123461 if ( ! checkIfCurrentPageActive ( ) ) {
35133462 return ;
35143463 }
3515- navigateToAndOpenReport ( [ CONST . EMAIL . CONCIERGE ] , allPersonalDetails , currentUserAccountID , introSelected , isSelfTourViewed , undefined , shouldDismissModal ) ;
3464+ navigateToAndOpenReport ( [ CONST . EMAIL . CONCIERGE ] , currentUserAccountID , introSelected , isSelfTourViewed , undefined , shouldDismissModal ) ;
35163465 } ) ;
35173466 } else if ( shouldDismissModal ) {
35183467 Navigation . dismissModalWithReport ( { reportID : conciergeReportID , reportActionID} ) ;
@@ -7412,5 +7361,3 @@ export {
74127361 prepareOnyxDataForCleanUpOptimisticParticipants ,
74137362 getGuidedSetupDataForOpenReport ,
74147363} ;
7415-
7416- export type { ParticipantInfo } ;
0 commit comments