From c10bc1a9ece53646252b517fda6e08bbb4d5eaf2 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 2 Jul 2024 23:18:17 +0800 Subject: [PATCH 1/3] fix optimistic user detail page isn't disabled --- src/libs/ReportUtils.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index cf47864a779e..a55eaff05ab1 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1111,12 +1111,11 @@ function isProcessingReport(report: OnyxEntry): boolean { * and personal detail of participant is optimistic data */ function shouldDisableDetailPage(report: OnyxEntry): boolean { - const participantAccountIDs = Object.keys(report?.participants ?? {}).map(Number); - if (isChatRoom(report) || isPolicyExpenseChat(report) || isChatThread(report) || isTaskReport(report)) { return false; } - if (participantAccountIDs.length === 1) { + if (isOneOnOneChat(report)) { + const participantAccountIDs = Object.keys(report?.participants ?? {}).map(Number).filter((accountID) => accountID !== currentUserAccountID); return isOptimisticPersonalDetail(participantAccountIDs[0]); } return false; From 40e86c2c3d156f8f8030e589b8d776b31d8a6ceb Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 3 Jul 2024 00:31:47 +0800 Subject: [PATCH 2/3] update cursor --- src/pages/home/report/ReportActionItemCreated.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItemCreated.tsx b/src/pages/home/report/ReportActionItemCreated.tsx index abf5d4dab8ee..2bfc46cfca89 100644 --- a/src/pages/home/report/ReportActionItemCreated.tsx +++ b/src/pages/home/report/ReportActionItemCreated.tsx @@ -68,7 +68,7 @@ function ReportActionItemCreated(props: ReportActionItemCreatedProps) { ReportUtils.navigateToDetailsPage(props.report)} - style={[styles.mh5, styles.mb3, styles.alignSelfStart]} + style={[styles.mh5, styles.mb3, styles.alignSelfStart, shouldDisableDetailPage && styles.cursorDefault]} accessibilityLabel={translate('common.details')} role={CONST.ROLE.BUTTON} disabled={shouldDisableDetailPage} From 5f3ccd42843cfb524c9509aae4894f6a5f52d06c Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 3 Jul 2024 00:31:56 +0800 Subject: [PATCH 3/3] prettier --- src/libs/ReportUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a55eaff05ab1..72195ada7a06 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1115,7 +1115,9 @@ function shouldDisableDetailPage(report: OnyxEntry): boolean { return false; } if (isOneOnOneChat(report)) { - const participantAccountIDs = Object.keys(report?.participants ?? {}).map(Number).filter((accountID) => accountID !== currentUserAccountID); + const participantAccountIDs = Object.keys(report?.participants ?? {}) + .map(Number) + .filter((accountID) => accountID !== currentUserAccountID); return isOptimisticPersonalDetail(participantAccountIDs[0]); } return false;