Skip to content

[Payment due @gijoe0295] Allow admins to delete a member report containing cash or card expenses - #101223

Merged
arosiclair merged 15 commits into
Expensify:mainfrom
hungvu193:follow-up-678343
Oct 9, 2026
Merged

arosiclair merged 15 commits into
Expensify:mainfrom
hungvu193:follow-up-678343

Conversation

@hungvu193

@hungvu193 hungvu193 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Allow admins to delete a member report containing cash or card expenses except Expensify card transaction

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/681901
$ #102279
PROPOSAL: N/A

Tests

Prerequisite:

  • You're admin of the workspace.
  1. Invite member B to your workspace.
  2. Assign them a card with transaction.
  3. Verify that you can delete the card transaction.

Use the csv below to import card transaction:

test.csv

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-09-28.at.17.56.39.mov
Screen.Recording.2026-09-28.at.17.07.45.mov

@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/hooks/useSearchBulkActions.ts 80.10% <100.00%> (+0.02%) ⬆️
src/libs/ReportUtils.ts 88.64% <100.00%> (-0.01%) ⬇️
src/hooks/useExpenseActions.ts 66.20% <0.00%> (-0.31%) ⬇️
... and 8 files with indirect coverage changes

@hungvu193 hungvu193 changed the title Follow up 678343 Allow admins to delete a member report containing cash or card expenses Sep 28, 2026
@hungvu193

Copy link
Copy Markdown
Contributor Author

@MelvinBot Merge main

…/App into follow-up-678343

Co-authored-by: Hans Vu <hungvu193@users.noreply.github.com>

# Conflicts:
#	src/hooks/useExpenseActions.ts
#	src/libs/ReportUtils.ts
@MelvinBot

Copy link
Copy Markdown
Contributor

I merged main into this branch and pushed the merge commit (1d54871).

I resolved two conflicts:

  • src/hooks/useExpenseActions.ts: main moved the isDeletingOwnExpense declaration to the top of the hook, so I kept main's version and dropped the duplicate local declaration.
  • src/libs/ReportUtils.ts: I kept this PR's Expensify Card check in canDeleteMoneyRequestReport. main still had return true there.

I couldn't run typecheck or lint locally. Please confirm the CI checks pass.

@hungvu193
hungvu193 marked this pull request as ready for review September 28, 2026 10:58
@hungvu193
hungvu193 requested review from a team as code owners September 28, 2026 10:58
@melvin-bot
melvin-bot Bot requested a review from gijoe0295 September 28, 2026 10:58
@melvin-bot

melvin-bot Bot commented Sep 28, 2026

Copy link
Copy Markdown

@gijoe0295 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from flaviadefaria and removed request for a team September 28, 2026 10:58
@github-actions

Copy link
Copy Markdown
Contributor

🚧 flaviadefaria has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@flaviadefaria

Copy link
Copy Markdown
Contributor

LGTM! I haven't been able to test what happens when an admin tries to delete a report with Expensify card transactions, as I don't have access to one with actual transactions. Are you all able to test this? If so, can you post a recording?

@hungvu193

Copy link
Copy Markdown
Contributor Author

LGTM! I haven't been able to test what happens when an admin tries to delete a report with Expensify card transactions, as I don't have access to one with actual transactions. Are you all able to test this? If so, can you post a recording?

I used a mock Ecard transaction on my local, let me do it again and record a new video.

@hungvu193

Copy link
Copy Markdown
Contributor Author

@gijoe0295 You can review the code in the meantime.

@hungvu193

hungvu193 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Here's the video regarding Ecard transactions (I used mock data to insert these transactions to my local Ecard):

Screen.Recording.2026-09-30.at.11.35.47.mov

@gijoe0295

Copy link
Copy Markdown
Contributor

Hmm I can't reproduce the issue on main.

Screenshot 2026-09-30 at 14 52 14 Screenshot 2026-09-30 at 14 52 09

@flaviadefaria

Copy link
Copy Markdown
Contributor

Here's the video regarding Ecard transactions (I used mock data to insert these transactions to my local Ecard):

I noticed on the recording that all Ecard transactions are pending. Did you test this with non-pending transactions?

Also, I wonder if we should display the delete button, but then display an error message to avoid confusion from users, especially in the scenario where a report has both Ecard and non-Ecard expenses.

Error message: Expensify Card transactions can’t be unreported. Move them to another report before deleting.

@hungvu193

Copy link
Copy Markdown
Contributor Author

Hmm I can't reproduce the issue on main.

@gijoe0295 you're on main there right? Or in this PR? Anyway, please continue with the PR logic, we gonna fix 2 issues here 😄

@hungvu193

Copy link
Copy Markdown
Contributor Author

I noticed on the recording that all Ecard transactions are pending. Did you test this with non-pending transactions?

I do yeah. They're on the same case, we're checking for the type here (Ecard transaction).

Also, I wonder if we should display the delete button, but then display an error message to avoid confusion from users, especially in the scenario where a report has both Ecard and non-Ecard expenses.

Error message: Expensify Card transactions can’t be unreported. Move them to another report before deleting.

I can do it but do you think we need design decision here?

@flaviadefaria

Copy link
Copy Markdown
Contributor

I can do it but do you think we need design decision here?

I thought we already displayed an error message for this, which Joe posted here. So my understanding is that we'd just be updating the copy for Admins, but happy to get the Design team involved.

@hungvu193

Copy link
Copy Markdown
Contributor Author

I can do it but do you think we need design decision here?

I thought we already displayed an error message for this, which Joe posted here. So my understanding is that we'd just be updating the copy for Admins, but happy to get the Design team involved.

Oh that was a different one where we try to delete transaction without auto reporting enable.

@flaviadefaria

Copy link
Copy Markdown
Contributor

@gijoe0295 @hungvu193 I see you’re actively working on this PR — thank you! It’d be great if we could get it merged by the end of this week, as I’d like to include this change in the next product update. Do you think we can work towards that timeline? Thanks!

@hungvu193

hungvu193 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

@gijoe0295 Could you prioritize the review today?

@flaviadefaria

Copy link
Copy Markdown
Contributor

@gijoe0295 can you prioritize this review today? We're hoping to merge this by tomorrow so we can announce the change in the next product update, which means it needs to be live by next week.

@gijoe0295

Copy link
Copy Markdown
Contributor

On it now

@gijoe0295 gijoe0295 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@melvin-bot melvin-bot Bot changed the title Allow admins to delete a member report containing cash or card expenses [Payment due @gijoe0295] Allow admins to delete a member report containing cash or card expenses Oct 8, 2026
@melvin-bot

melvin-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

🎯 @gijoe0295, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/681901.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

@gijoe0295

Copy link
Copy Markdown
Contributor

@hungvu193 We have conflicts

@hungvu193

Copy link
Copy Markdown
Contributor Author

@MelvinBot Help me resolve conflicts and merge main please.

Co-authored-by: Hans Vu <hungvu193@users.noreply.github.com>

# Conflicts:
#	src/libs/ReportUtils.ts
@MelvinBot

Copy link
Copy Markdown
Contributor

I merged main into this branch and pushed the result in aada25a. The PR can merge again.

There was one conflict. It was in the TransactionUtils import list in src/libs/ReportUtils.ts. This PR added isExpensifyCardTransaction, and main added isExpenseValueUnsettled on the same line. I kept both imports, because the code uses both.

npm run typecheck and npm run lint-changed both pass.


view run

@hungvu193

Copy link
Copy Markdown
Contributor Author

@MelvinBot The failing test is flaky right?

@hungvu193
hungvu193 requested a review from arosiclair October 8, 2026 16:09
@hungvu193

Copy link
Copy Markdown
Contributor Author

@arosiclair Requested review from you since you were assigned on the original issue, I don't know why Melvin doesn't auto trigger random puller bear.

@MelvinBot

Copy link
Copy Markdown
Contributor

Yes, it looks flaky and unrelated to this PR. Re-running the failed job should clear it.

Evidence
  • Failing tests: the two SAML sign out tests in tests/actions/SessionTest.ts:691-727 failed in test (job 4) with Number of calls: 0 on openAuthSessionAsync.
  • No overlap with this PR: the PR changes ReportUtils, two hooks, and language files. It does not touch sign-out or session code.
  • Passes locally: SessionTest.ts passed 82/82 on this PR's head (aada25a). It also passed on the exact main commit that CI merged into (22559f3).
  • Likely cause: the tests assert right after a single waitForBatchedUpdates(). A slow CI runner can leave the redirect call pending at that point.

I couldn't re-run the job from here. Use Re-run failed jobs on the failed run.


view run

Comment thread tests/unit/LocalizeTests.ts
Comment thread tests/unit/hooks/useExpenseActionsInvoiceDeleteTest.tsx
@arosiclair
arosiclair merged commit 5ec2f63 into Expensify:main Oct 9, 2026
35 of 36 checks passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🚧 arosiclair has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

OSBotify commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/arosiclair in version: 9.5.7-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update is needed: this PR adjusts who can delete a report containing card expenses and rewords the delete confirmation, but no sentence in an existing article describes those rules, so none became incorrect.


view run

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants