@@ -232,6 +232,7 @@ import type {
232232 VisibleReportActionsDerivedValue ,
233233} from '@src/types/onyx' ;
234234import type { Decision } from '@src/types/onyx/OriginalMessage' ;
235+ import type PersonalDetails from '@src/types/onyx/PersonalDetails' ;
235236import type { CurrentUserPersonalDetails , Timezone } from '@src/types/onyx/PersonalDetails' ;
236237import type { ConnectionName } from '@src/types/onyx/Policy' ;
237238import type { NotificationPreference , Participants , Participant as ReportParticipant , RoomVisibility , WriteCapability } from '@src/types/onyx/Report' ;
@@ -482,6 +483,20 @@ Onyx.connect({
482483 } ,
483484} ) ;
484485
486+ /**
487+ * Builds a partial PersonalDetailsList containing only the records passed in. Skips entries with no accountID.
488+ */
489+ function buildPersonalDetailsList ( details : Array < OnyxEntry < PersonalDetails > > ) : PersonalDetailsList {
490+ const result : PersonalDetailsList = { } ;
491+ for ( const detail of details ) {
492+ if ( detail ?. accountID == null ) {
493+ continue ;
494+ }
495+ result [ detail . accountID ] = detail ;
496+ }
497+ return result ;
498+ }
499+
485500const typingWatchTimers : Record < string , NodeJS . Timeout > = { } ;
486501
487502// Track subscriptions to conciergeReasoning Pusher events to avoid duplicates.
@@ -2344,8 +2359,7 @@ function navigateToAndOpenReportWithAccountIDs(
23442359 introSelected : OnyxEntry < IntroSelected > ,
23452360 isSelfTourViewed : boolean | undefined ,
23462361 betas : OnyxEntry < Beta [ ] > ,
2347- // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656
2348- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
2362+ personalDetails : OnyxEntry < PersonalDetailsList > ,
23492363 shouldRevalidateExistingChat = false ,
23502364) {
23512365 const participants = participantAccountIDs . map ( ( accountID ) : ParticipantInfo => {
@@ -2372,8 +2386,7 @@ function navigateToAndOpenReportWithAccountIDs(
23722386 newReportObject : fallbackChat ,
23732387 parentReportActionID : '0' ,
23742388 participants,
2375- // TODO: allPersonalDetails fallback should be removed in follow-up PRs https://github.com/Expensify/App/issues/73656
2376- personalDetails : personalDetails ?? allPersonalDetails ,
2389+ personalDetails,
23772390 betas,
23782391 } ) ;
23792392
@@ -2431,9 +2444,8 @@ function navigateToAndOpenChildReport(
24312444 currentUserAccountID : number ,
24322445 introSelected : OnyxEntry < IntroSelected > ,
24332446 betas : OnyxEntry < Beta [ ] > ,
2447+ personalDetails : OnyxEntry < PersonalDetailsList > ,
24342448 isSelfTourViewed : boolean | undefined ,
2435- // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656
2436- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
24372449) {
24382450 const report = childReport ?? createChildReport ( childReport , parentReportAction , parentReport , currentUserAccountID , introSelected , betas , isSelfTourViewed , personalDetails ) ;
24392451
@@ -3428,9 +3440,8 @@ function toggleSubscribeToChildReport(
34283440 introSelected : OnyxEntry < IntroSelected > ,
34293441 isSelfTourViewed : boolean | undefined ,
34303442 betas : OnyxEntry < Beta [ ] > ,
3431- prevNotificationPreference ?: NotificationPreference ,
3432- // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656
3433- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
3443+ prevNotificationPreference : NotificationPreference | undefined ,
3444+ personalDetails : OnyxEntry < PersonalDetailsList > ,
34343445) {
34353446 if ( childReportID ) {
34363447 openReport ( { reportID : childReportID , introSelected, betas, isSelfTourViewed} ) ;
@@ -3474,8 +3485,7 @@ function toggleSubscribeToChildReport(
34743485 reportID : newChat . reportID ,
34753486 introSelected,
34763487 participants,
3477- // TODO: allPersonalDetails fallback should be removed in follow-up PRs https://github.com/Expensify/App/issues/73656
3478- personalDetails : personalDetails ?? allPersonalDetails ,
3488+ personalDetails,
34793489 newReportObject : newChat ,
34803490 parentReportActionID : parentReportAction . reportActionID ,
34813491 isSelfTourViewed,
@@ -4362,26 +4372,29 @@ function deleteReport(reportID: string | undefined, shouldDeleteChildReports = f
43624372/**
43634373 * @param reportID The reportID of the policy report (workspace room)
43644374 */
4375+ // eslint-disable-next-line @typescript-eslint/max-params
43654376function navigateToConciergeChatAndDeleteReport (
43664377 reportID : string | undefined ,
43674378 conciergeReportID : string | undefined ,
43684379 currentUserAccountID : number ,
43694380 introSelected : OnyxEntry < IntroSelected > ,
43704381 isSelfTourViewed : boolean | undefined ,
43714382 betas : OnyxEntry < Beta [ ] > ,
4383+ reportOwnerPersonalDetail : OnyxEntry < PersonalDetails > ,
4384+ currentUserPersonalDetail : OnyxEntry < PersonalDetails > ,
4385+ conciergePersonalDetail : OnyxEntry < PersonalDetails > ,
43724386 shouldPopToTop = false ,
43734387 shouldDeleteChildReports = false ,
4374- // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656
4375- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
43764388) {
43774389 // Dismiss the current report screen and replace it with Concierge Chat
43784390 if ( shouldPopToTop ) {
43794391 Navigation . popToSidebar ( ) ;
43804392 } else {
43814393 Navigation . goBack ( ) ;
43824394 }
4383- // TODO: allPersonalDetails fallback should be removed in follow-up PRs https://github.com/Expensify/App/issues/73656
4384- navigateToConciergeChat ( conciergeReportID , introSelected , currentUserAccountID , isSelfTourViewed , betas , false , undefined , undefined , undefined , personalDetails ?? allPersonalDetails ) ;
4395+ const personalDetails = buildPersonalDetailsList ( [ reportOwnerPersonalDetail , currentUserPersonalDetail , conciergePersonalDetail ] ) ;
4396+ navigateToConciergeChat ( conciergeReportID , introSelected , currentUserAccountID , isSelfTourViewed , betas , false , undefined , undefined , undefined , personalDetails ) ;
4397+ // eslint-disable-next-line @typescript-eslint/no-deprecated
43854398 InteractionManager . runAfterInteractions ( ( ) => {
43864399 deleteReport ( reportID , shouldDeleteChildReports ) ;
43874400 } ) ;
@@ -4394,6 +4407,9 @@ function clearCreateChatError(
43944407 currentUserAccountID : number ,
43954408 betas : OnyxEntry < Beta [ ] > ,
43964409 isSelfTourViewed : boolean | undefined ,
4410+ reportOwnerPersonalDetail : OnyxEntry < PersonalDetails > ,
4411+ currentUserPersonalDetail : OnyxEntry < PersonalDetails > ,
4412+ conciergePersonalDetail : OnyxEntry < PersonalDetails > ,
43974413) {
43984414 const metaData = getReportMetadata ( report ?. reportID ) ;
43994415 const isOptimisticReport = metaData ?. isOptimisticReport ;
@@ -4402,7 +4418,19 @@ function clearCreateChatError(
44024418 return ;
44034419 }
44044420
4405- navigateToConciergeChatAndDeleteReport ( report ?. reportID , conciergeReportID , currentUserAccountID , introSelected , isSelfTourViewed , betas , undefined , true ) ;
4421+ navigateToConciergeChatAndDeleteReport (
4422+ report ?. reportID ,
4423+ conciergeReportID ,
4424+ currentUserAccountID ,
4425+ introSelected ,
4426+ isSelfTourViewed ,
4427+ betas ,
4428+ reportOwnerPersonalDetail ,
4429+ currentUserPersonalDetail ,
4430+ conciergePersonalDetail ,
4431+ undefined ,
4432+ true ,
4433+ ) ;
44064434}
44074435
44084436/**
0 commit comments