From 68ecedf7c68c22828900be5650465000c4dba677 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 9 Dec 2024 12:58:56 -0700 Subject: [PATCH] Revert "add go to workspace shortcut to report details page" --- src/CONST.ts | 1 - src/pages/ReportDetailsPage.tsx | 57 ++++++++++++--------------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 44b2fd16f64cf..2e03f9a8eedb5 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3180,7 +3180,6 @@ const CONST = { CANCEL_PAYMENT: 'cancelPayment', UNAPPROVE: 'unapprove', DEBUG: 'debug', - GO_TO_WORKSPACE: 'goToWorkspace', }, EDIT_REQUEST_FIELD: { AMOUNT: 'amount', diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 54f79676fd377..9d2d7e4ada75a 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -291,7 +291,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta const shouldShowNotificationPref = !isMoneyRequestReport && ReportUtils.getReportNotificationPreference(report) !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; const shouldShowWriteCapability = !isMoneyRequestReport; const shouldShowMenuItem = shouldShowNotificationPref || shouldShowWriteCapability || (!!report?.visibility && report.chatType !== CONST.REPORT.CHAT_TYPE.INVOICE); - const shouldShowGoToWorkspace = policy && policy.type !== CONST.POLICY.TYPE.PERSONAL && policy.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; const isPayer = ReportUtils.isPayer(session, moneyRequestReport); const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID ?? '-1'); @@ -451,6 +450,23 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta }); } + if (shouldShowLeaveButton) { + items.push({ + key: CONST.REPORT_DETAILS_MENU_ITEM.LEAVE_ROOM, + translationKey: 'common.leave', + icon: Expensicons.Exit, + isAnonymousAction: true, + action: () => { + if (ReportUtils.getParticipantsAccountIDsForDisplay(report, false, true).length === 1 && isRootGroupChat) { + setIsLastMemberLeavingGroupModalVisible(true); + return; + } + + leaveChat(); + }, + }); + } + if (isMoneyRequestReport) { items.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.DOWNLOAD, @@ -492,23 +508,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta }); } - if (shouldShowGoToWorkspace) { - items.push({ - key: CONST.REPORT_DETAILS_MENU_ITEM.GO_TO_WORKSPACE, - translationKey: 'workspace.common.goToWorkspace', - icon: Expensicons.Building, - action: () => { - if (isSmallScreenWidth) { - Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(report?.policyID ?? '-1')); - return; - } - Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(report?.policyID ?? '-1')); - }, - isAnonymousAction: false, - shouldShowRightIcon: true, - }); - } - if (report?.reportID && isDebugModeEnabled) { items.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.DEBUG, @@ -525,6 +524,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta isSelfDM, isArchivedRoom, isGroupChat, + isRootGroupChat, isDefaultRoom, isChatThread, isPolicyEmployee, @@ -543,12 +543,14 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta shouldShowMenuItem, isTaskReport, isCanceledTaskReport, + shouldShowLeaveButton, activeChatMembers.length, shouldOpenRoomMembersPage, shouldShowCancelPaymentButton, session, isOffline, transactionIDList, + leaveChat, canUnapproveRequest, isDebugModeEnabled, unapproveExpenseReportOrShowModal, @@ -560,8 +562,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta parentReportAction, moneyRequestReport?.reportID, isDeletedParentAction, - isSmallScreenWidth, - shouldShowGoToWorkspace, ]); const displayNamesWithTooltips = useMemo(() => { @@ -920,23 +920,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta /> ))} - {shouldShowLeaveButton && ( - { - if (ReportUtils.getParticipantsAccountIDsForDisplay(report, false, true).length === 1 && isRootGroupChat) { - setIsLastMemberLeavingGroupModalVisible(true); - return; - } - - leaveChat(); - }} - /> - )} - {shouldShowDeleteButton && (