Skip to content

Commit

Permalink
Merge pull request #53787 from Expensify/revert-53076-mkzie2-issue/52817
Browse files Browse the repository at this point in the history
Revert "add go to workspace shortcut to report details page"

(cherry picked from commit e6973c0)

(CP triggered by luacmartins)
  • Loading branch information
luacmartins authored and OSBotify committed Dec 9, 2024
1 parent 7b3e1c8 commit 1a5415d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 38 deletions.
1 change: 0 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3180,7 +3180,6 @@ const CONST = {
CANCEL_PAYMENT: 'cancelPayment',
UNAPPROVE: 'unapprove',
DEBUG: 'debug',
GO_TO_WORKSPACE: 'goToWorkspace',
},
EDIT_REQUEST_FIELD: {
AMOUNT: 'amount',
Expand Down
57 changes: 20 additions & 37 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -525,6 +524,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
isSelfDM,
isArchivedRoom,
isGroupChat,
isRootGroupChat,
isDefaultRoom,
isChatThread,
isPolicyEmployee,
Expand All @@ -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,
Expand All @@ -560,8 +562,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
parentReportAction,
moneyRequestReport?.reportID,
isDeletedParentAction,
isSmallScreenWidth,
shouldShowGoToWorkspace,
]);

const displayNamesWithTooltips = useMemo(() => {
Expand Down Expand Up @@ -920,23 +920,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
/>
))}

{shouldShowLeaveButton && (
<MenuItem
key={CONST.REPORT_DETAILS_MENU_ITEM.LEAVE_ROOM}
icon={Expensicons.Exit}
title={translate('common.leave')}
isAnonymousAction
onPress={() => {
if (ReportUtils.getParticipantsAccountIDsForDisplay(report, false, true).length === 1 && isRootGroupChat) {
setIsLastMemberLeavingGroupModalVisible(true);
return;
}

leaveChat();
}}
/>
)}

{shouldShowDeleteButton && (
<MenuItem
key={CONST.REPORT_DETAILS_MENU_ITEM.DELETE}
Expand Down

0 comments on commit 1a5415d

Please sign in to comment.