Skip to content

[Due for payment 2025-10-15] [Due for payment 2025-09-30] [$250] We show delete button for unreported card expenses imported with deleting disabled #66724

Closed

Description

@m-natarajan

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.83-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @joekaufmanexpensify
Slack conversation (hyperlinked to channel name): #Convert

Action Performed:

  1. Connect a card feed
  2. Make sure "allow deleting transactions" is disabled
  3. Assign a card with expenses
  4. Unreport the expenses
  5. Go to your personal space
  6. Tap one of the expenses.

Expected Result:

We hide the option to delete the expenses, since it maps back to a card on a workspace where transaction deleting is disabled.

Actual Result:

We show delete button, but throw an API error when you try to delete.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
2025-07-17_15-36-54.mp4
Image
Recording.1432.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021948036590874577665
  • Upwork Job ID: 1948036590874577665
  • Last Price Increase: 2025-08-23
Issue OwnerCurrent Issue Owner: @CortneyOfstad

Activity

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

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (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. melvin-bot commented on Jul 21, 2025

    @melvin-bot

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

  4. linhvovan29546 commented on Jul 22, 2025

    @linhvovan29546
    Contributor

    Proposal

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

    We show delete button for unreported card expenses imported with deleting disabled

    What is the root cause of that problem?

    We currently show the delete button for unreported when the user is the owner. The issue occurs because we do not check if the card expense was imported with deletion disabled.

    if (isUnreported) {
    return isOwner;
    }

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

    We should update the condition to handle this case by checking if the card transaction is imported with deletion disabled.

    if (isUnreported) {
    return isOwner;
    }

        if (isUnreported) {
    // Instead of checking for RESTRICT below, we can use canDeleteCardTransactionByLiabilityType to check for the ALLOW type. => isOwner && canDeleteCardTransactionByLiabilityType(transaction)
            const isCardTransactionWithCorporateLiability = isCardTransactionUtils(transaction) && transaction?.comment?.liabilityType === CONST.TRANSACTION.LIABILITY_TYPE.RESTRICT;
            return isOwner && !isCardTransactionWithCorporateLiability;
        }

    And here when right click the IOU to display the popover

    if (isActionOwner) {

            if (isActionOwner) {
                // Alternatively, we can return early here if isCardTransactionCanBeDeleted is false, like this: if(!isCardTransactionCanBeDeleted){return false}
                if(isTrackExpenseAction(reportAction)){
                    return isCardTransactionCanBeDeleted
                }
              ... Other 

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

    We should write tests for getSecondaryReportActions to ensure it does not return the DELETE action and for the isDeleteAction

    What alternative solutions did you explore? (Optional)

    Return early if isCardTransactionWithCorporateLiability is true. The condition could be moved up, like so:

            const isCardTransactionWithCorporateLiability =
                isSingleTransaction && isCardTransactionUtils(transaction) && transaction?.comment?.liabilityType === CONST.TRANSACTION.LIABILITY_TYPE.RESTRICT;
    
            if (isCardTransactionWithCorporateLiability) {
                return false;
            }
  5. added
    External
    retest-weekly
    on Jul 23, 2025
  6. changed the title [-]We show delete button for unreported card expenses imported with deleting disabled[/-] [+][$250] We show delete button for unreported card expenses imported with deleting disabled[/+] on Jul 23, 2025
  7. melvin-bot commented on Jul 23, 2025

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

    @melvin-bot

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

  10. 87 remaining items

  11. melvin-bot commented on Sep 23, 2025

    @melvin-bot

    @mananjadhav / @linhvovan29546 @CortneyOfstad The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  12. added
    Daily
    and removed
    Weekly
    on Sep 29, 2025
  13. melvin-bot commented on Sep 30, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@CortneyOfstad)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1948036590874577665/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  14. CortneyOfstad commented on Oct 2, 2025

    @CortneyOfstad
    Contributor

    Payment Summary

    @mananjadhav — to be paid $250 via NewDot
    @linhvovan29546 – paid $250 via Upwork

  15. added
    Weekly
    and removed
    Daily
    on Oct 2, 2025
  16. changed the title [-][Due for payment 2025-09-30] [$250] We show delete button for unreported card expenses imported with deleting disabled[/-] [+][Due for payment 2025-10-15] [Due for payment 2025-09-30] [$250] We show delete button for unreported card expenses imported with deleting disabled[/+] on Oct 8, 2025
  17. melvin-bot commented on Oct 8, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.27-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-10-15. 🎊

    For reference, here are some details about the assignees on this issue:

  18. melvin-bot commented on Oct 8, 2025

    @melvin-bot

    @mananjadhav / @linhvovan29546 @CortneyOfstad The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  19. quinthar commented on Nov 12, 2025

    @quinthar
    Contributor

    Approved $250 to @mananjadhav

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

Metadata

Metadata

Labels

Awaiting PaymentBugExternalWeeklyretest-weekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions