From e63898118eeeb70f9b17944ed618144a9afd939a Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Tue, 10 Sep 2024 12:13:32 +0530 Subject: [PATCH 1/2] Fix settlement button --- src/components/SettlementButton.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index e68d09375d49..ace2ee61be88 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -164,11 +164,8 @@ function SettlementButton({ // The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here. const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || -1}`); const isInvoiceReport = (!isEmptyObject(iouReport) && ReportUtils.isInvoiceReport(iouReport)) || false; - const isPaidGroupPolicy = ReportUtils.isPaidGroupPolicyExpenseChat(chatReport); - const shouldShowPaywithExpensifyOption = - !isPaidGroupPolicy || - (!shouldHidePaymentOptions && ReportUtils.isPayer(session, iouReport) && policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL); - const shouldShowPayElsewhereOption = (!isPaidGroupPolicy || policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL) && !isInvoiceReport; + const shouldShowPaywithExpensifyOption = !shouldHidePaymentOptions && policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL; + const shouldShowPayElsewhereOption = !shouldHidePaymentOptions && !isInvoiceReport; const paymentButtonOptions = useMemo(() => { const buttonOptions = []; const isExpenseReport = ReportUtils.isExpenseReport(iouReport); From b2b90b2393f826af5acffbd963ac19b9fff21e6f Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Fri, 13 Sep 2024 08:35:38 +0530 Subject: [PATCH 2/2] Fix lint --- src/components/SettlementButton.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index 37b3ba0d5ed0..aa9f7712d537 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -23,7 +23,6 @@ import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import type {PaymentType} from './ButtonWithDropdownMenu/types'; import * as Expensicons from './Icon/Expensicons'; import KYCWall from './KYCWall'; -import {useSession} from './OnyxProvider'; type KYCFlowEvent = GestureResponderEvent | KeyboardEvent | undefined; @@ -155,7 +154,6 @@ function SettlementButton({ }: SettlementButtonProps) { const {translate} = useLocalize(); const {isOffline} = useNetwork(); - const session = useSession(); // The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here. const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || -1}`); const isInvoiceReport = (!isEmptyObject(iouReport) && ReportUtils.isInvoiceReport(iouReport)) || false;