Skip to content

Commit

Permalink
Merge pull request #44737 from bernhardoj/fix/43278-disable-navigatin…
Browse files Browse the repository at this point in the history
…g-to-profile-page

Disable navigating to profile page if the user is optimistic
  • Loading branch information
arosiclair authored Jul 3, 2024
2 parents 35ae731 + 5f3ccd4 commit 00e7b1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1120,12 +1120,13 @@ function isProcessingReport(report: OnyxEntry<Report>): boolean {
* and personal detail of participant is optimistic data
*/
function shouldDisableDetailPage(report: OnyxEntry<Report>): 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;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function ReportActionItemCreated(props: ReportActionItemCreatedProps) {
<OfflineWithFeedback pendingAction={props.report?.pendingFields?.avatar}>
<PressableWithoutFeedback
onPress={() => 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}
Expand Down

0 comments on commit 00e7b1e

Please sign in to comment.