Skip to content

[$250] Distance - Replace receipt zone is present when dragging an image over distance expense RHP #65629

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.1.77-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #65327
Email or phone of affected tester (no customers): applausetester+0700798kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Log in with Expensifail account.
  1. Go to staging.expensify.com
  2. Go to workspace chat.
  3. Create two distance expenses to the workspace chat.
  4. Open transaction thread of any distance expense.
  5. Drag and drop an image to Replace receipt zone on the expense thread RHP.

Expected Result:

Replace receipt zone should not appear when dragging an image over distance expense RHP.

Actual Result:

Replace receipt zone is present when dragging an image over distance expense RHP.
App shows error after dropping the image on Replace receipt zone on distance RHP.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6881261_1751965962351.20250708_170638.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021942739303022790580
  • Upwork Job ID: 1942739303022790580
  • Last Price Increase: 2025-07-09
  • Automatic offers:
    • truph01 | Contributor | 108009771
Issue OwnerCurrent Issue Owner: @alexpensify

Activity

  1. added
    Daily
    Bug
    on Jul 8, 2025
  2. melvin-bot commented on Jul 8, 2025

    @melvin-bot

    Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. Burhan-Rashid commented on Jul 8, 2025

    @Burhan-Rashid
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Distance - Replace receipt zone is present when dragging an image over distance expense RHP

    What is the root cause of that problem?

    We are using DualDropZone in ReportActionsCompose and we show it when shouldDisplayDualDropZone is true. But while calculating the shouldDisplayDualDropZone we are not considering the distance transaction which makes shouldDisplayDualDropZone as true for distance expenses as well.

    const shouldDisplayDualDropZone = useMemo(
    () =>
    !isChatRoom(report) &&
    !isUserCreatedPolicyRoom(report) &&
    !isAnnounceRoom(report) &&
    !isAdminRoom(report) &&
    !isConciergeChatReport(report) &&
    !isInvoiceReport(report) &&
    !isGroupChat(report) &&
    !isSettled(parentReport) &&
    !isSettled(report),
    [report, parentReport],
    );

    What changes do you think we should make in order to solve the problem?

    We need to check if it is a distance expense and if it is a distance expense we don't need to show the dualDropZone, For that we need to make the change here

        const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true});
    const shouldDisplayDualDropZone = useMemo(
            () =>
                !isChatRoom(report) &&
                !isUserCreatedPolicyRoom(report) &&
                !isAnnounceRoom(report) &&
                !isAdminRoom(report) &&
                !isConciergeChatReport(report) &&
                !isInvoiceReport(report) &&
                !isGroupChat(report) &&
                !isSettled(parentReport) &&
                !isSettled(report) &&
                !isDistanceRequest(transaction),
            [report, parentReport, transaction],
        );

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. truph01 commented on Jul 8, 2025

    @truph01
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Distance - Replace receipt zone is present when dragging an image over distance expense RHP

    What is the root cause of that problem?

    The issue arises because we display the "Replace receipt" drop zone unconditionally, without verifying whether the user has permission to edit the receipt. This check is already in place on the Transaction Receipt page but is missing here.

    const shouldDisplayDualDropZone = useMemo(
    () =>
    !isChatRoom(report) &&
    !isUserCreatedPolicyRoom(report) &&
    !isAnnounceRoom(report) &&
    !isAdminRoom(report) &&
    !isConciergeChatReport(report) &&
    !isInvoiceReport(report) &&
    !isGroupChat(report) &&
    !isSettled(parentReport) &&
    !isSettled(report),
    [report, parentReport],
    );

    What changes do you think we should make in order to solve the problem?

    We should apply the same permission logic in ReportActionCompose.tsx to determine whether the user can edit receipts.

    1. Create a new canEditReceipt variable:
    
    const parentReportAction = getReportAction(report?.parentReportID, report?.parentReportActionID);
    const canUserPerformWriteAction = !!canUserPerformWriteActionReportUtils(report);
    const canEditReceipt =
        canUserPerformWriteAction &&
        canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.RECEIPT) &&
        !transaction?.receipt?.isTestDriveReceipt;
    
    1. Pass canEditReceipt as a prop to the DualDropZone component.

    3.a. Use canEditReceipt to conditionally render the "Replace receipt" drop zone in DualDropZone.tsx:

    <DropZoneWrapper onDrop={onReceiptDrop}>

                    {isEditing ? (
                        canEditReceipt && (
                            <DropZoneWrapper onDrop={onReceiptDrop}>
                                {({isDraggingOver}) => (
                                    <DropZoneUI
                                        icon={Expensicons.ReplaceReceipt}
                                        dropTitle={translate(isEditing ? 'dropzone.replaceReceipt' : 'dropzone.scanReceipts')}
                                        dropStyles={styles.receiptDropOverlay(isDraggingOver)}
                                        dropTextStyles={styles.receiptDropText}
                                        dropInnerWrapperStyles={styles.receiptDropInnerWrapper(isDraggingOver)}
                                    />
                                )}
                            </DropZoneWrapper>
                        )
                    ) : (
                        <DropZoneWrapper onDrop={onReceiptDrop}>
                            {({isDraggingOver}) => (
                                <DropZoneUI
                                    icon={Expensicons.SmartScan}
                                    dropTitle={translate(isEditing ? 'dropzone.replaceReceipt' : 'dropzone.scanReceipts')}
                                    dropStyles={styles.receiptDropOverlay(isDraggingOver)}
                                    dropTextStyles={styles.receiptDropText}
                                    dropInnerWrapperStyles={styles.receiptDropInnerWrapper(isDraggingOver)}
                                />
                            )}
                        </DropZoneWrapper>
                    )}
    

    3.b. If isEditing: true and canEditReceipt: true, display the "Replace receipt". Otherwise, display the "Scan receipt".

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    • None

    What alternative solutions did you explore? (Optional)

    • We can update shouldDisplayDualDropZone so that it will be:
    shouldDisplayDualDropZone = ... && canEditReceipt
    
  5. added
    External
    on Jul 9, 2025
  6. changed the title [-]Distance - Replace receipt zone is present when dragging an image over distance expense RHP[/-] [+][$250] Distance - Replace receipt zone is present when dragging an image over distance expense RHP[/+] on Jul 9, 2025
  7. melvin-bot commented on Jul 9, 2025

    @melvin-bot
  8. added
    Help Wanted
    on Jul 9, 2025
  9. melvin-bot commented on Jul 9, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale (External)

  10. alexpensify commented on Jul 9, 2025

    @alexpensify
    Contributor

    @akinwale, when you get a chance, please review if one of these proposals will fix the issue? Thanks!

  11. akinwale commented on Jul 9, 2025

    @akinwale
    Contributor

    It should remain possible to update receipts for distance expenses, so @truph01's proposal works here.

    🎀👀🎀 C+ reviewed.

  12. melvin-bot commented on Jul 9, 2025

    @melvin-bot

    Triggered auto assignment to @MarioExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  13. 8 remaining items

  14. truph01 commented on Jul 12, 2025

    @truph01
    Contributor

    @akinwale @MarioExpensify I can't reproduce the issue since the PR is just merged 3 days ago.

  15. akinwale commented on Jul 13, 2025

    @akinwale
    Contributor

    In this case, 50% compensation would be due here based on the guidelines.

    cc @alexpensify

  16. alexpensify commented on Jul 14, 2025

    @alexpensify
    Contributor

    This week, I will review the payment request here

  17. alexpensify commented on Jul 18, 2025

    @alexpensify
    Contributor

    Still on my list to review the payment steps

  18. melvin-bot commented on Jul 21, 2025

    @melvin-bot

    @alexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  19. alexpensify commented on Jul 22, 2025

    @alexpensify
    Contributor

    Payment Summary

    Contributor: @truph01 paid $125 via Upwork
    Contributor+: @akinwale due $125 via NewDot-- please submit a request in Chat, thanks!

    Reason: Partial payment since this one went through the assignment phase

  20. JmillsExpensify commented on Jul 31, 2025

    @JmillsExpensify
    Contributor

    $125 approved for @akinwale

  21. isabelastisser commented on Aug 5, 2025

    @isabelastisser
    Contributor

    @akinwale has submitted payment for this report on ND [[here]

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Vendor found in VML: True. Status: Active

    Amount requested: $125.00 (Matches the payment summary[ here.]

    I am not already the BZ assignee. I have approved this payment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions