Skip to content

Hold and Reject Role based Modal updates#74505

Merged
luacmartins merged 25 commits intoExpensify:mainfrom
mananjadhav:fix/mj-63363-hold-modal-refactor
Nov 12, 2025
Merged

Hold and Reject Role based Modal updates#74505
luacmartins merged 25 commits intoExpensify:mainfrom
mananjadhav:fix/mj-63363-hold-modal-refactor

Conversation

@mananjadhav
Copy link
Collaborator

@mananjadhav mananjadhav commented Nov 6, 2025

Explanation of Change

Fixed Issues

$ #63363
PROPOSAL: N/A

Tests

1. Submitter View

Precondition:

  • Logged in as a submitter.
  • An expense is present in a report and can be held.
  • NVP nvp_dismissedHoldUseExplanation is not set in the account.
  • Test the same flow for single and multiple expense reports.

Test:

  1. Open the expense details view.
  2. Click on the More menu and select Hold.
  3. Verify that the Hold modal is opened with the title "Should you hold this expense?"
  4. Verify the content copy matches the issue description.
  5. Click Got it in the modal.
  6. The modal should close and the hold reason page should open.
  7. Verify nvp_dismissedHoldUseExplanation set to true.
  8. Exit out of the report and repeat the steps from 1 again.
  9. This time the modal shouldn't open and the hold reason page should open directly. All future hold actions should skip the modal.

2. Approver View: Hold

Precondition:

  • Logged in as a approver or workspace admin.
  • An expense is present in a report and can be held.
  • NVP nvp_dismissedRejectUseExplanation is not set in the account.
  • Test the same flow for single and multiple expense reports.

Test:

  1. Open the expense details view.
  2. Click on the More menu and select "Hold".
  3. Verify that the Hold modal is opened with the title "Should you hold or reject expense?"
  4. Verify the content copy matches the issue description.
  5. Click Got it in the modal.
  6. The modal should close and the hold reason page should open.
  7. Verify nvp_dismissedRejectUseExplanation set to true.
  8. Exit out of the report and repeat the steps from 1 again.
  9. This time the modal shouldn't open and the hold reason page should open directly. All future hold actions should skip the modal.
  10. For the same expense, click on More menu and select "Reject".
  11. It should open the reject reason page directly without any modal.

3. Approver View: Reject

Precondition:

  • Logged in as a approver or workspace admin.
  • An expense is present in a report and can be held.
  • NVP nvp_dismissedRejectUseExplanation is not set in the account.
  • Test the same flow for single and multiple expense reports.

Test:

  1. Open the expense details view.
  2. Click on the More menu and select "Reject".
  3. Verify that the Hold modal is opened with the title "Should you hold or reject expense?"
  4. Verify the content copy matches the issue description.
  5. Click Got it in the modal.
  6. The modal should close and the reject reason page should open.
  7. Verify nvp_dismissedRejectUseExplanation set to true.
  8. Exit out of the report and repeat the steps from 1 again.
  9. This time the modal shouldn't open and the reject reason page should open directly. All future reject actions should skip the modal.
  10. For the same expense, click on More menu and select "Hold".
  11. It should open the hold reason page directly without any modal.
  • Verify that no errors appear in the JS console

Offline tests

Same as Test Steps

QA Steps

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

Same as Test Steps

  • 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
    • MacOS: Desktop
  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

Submitter: Hold Modal

android-hold.mov

Approver: Hold vs Reject Modal

android-hold-vs-reject.mov
Android: mWeb Chrome

Submitter: Hold Modal

mweb-chrome-hold

Approver: Hold vs Reject Modal

mweb-chrome-hold-vs-reject
iOS: Native
iOS: mWeb Safari

Submitter: Hold Modal

mweb-safari-hold

Approver: Hold vs Reject Modal

mweb-safari-hold-vs-reject
MacOS: Chrome / Safari

Submitter: Hold Modal

web-hold-modal.mov

Approver: Hold vs Reject Modal

web-hold-vs-reject-modal.mov

**Note: ** For my test I added some dummy code to reset the NVP on View Details, so that I can show the modal twice in the same video.

MacOS: Desktop

Submitter: Hold Modal

desktop-hold.mov

Approver: Hold vs Reject Modal

desktop-hold-vs-reject.mov

@melvin-bot
Copy link

melvin-bot bot commented Nov 6, 2025

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@codecov
Copy link

codecov bot commented Nov 6, 2025

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/ONYXKEYS.ts 100.00% <ø> (ø)
src/ROUTES.ts 11.87% <ø> (+0.12%) ⬆️
src/SCREENS.ts 100.00% <ø> (ø)
...gator/Navigators/FeatureTrainingModalNavigator.tsx 66.66% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 75.00% <ø> (ø)
src/components/HoldSubmitterEducationalModal.tsx 16.66% <50.00%> (ø)
src/components/MoneyRequestHeader.tsx 0.84% <0.00%> (-0.05%) ⬇️
src/components/MoneyReportHeader.tsx 0.17% <0.00%> (-0.01%) ⬇️
... and 68 files with indirect coverage changes

@mananjadhav mananjadhav marked this pull request as ready for review November 6, 2025 20:45
@mananjadhav mananjadhav requested review from a team as code owners November 6, 2025 20:45
@melvin-bot melvin-bot bot requested a review from sobitneupane November 6, 2025 20:45
const [isDownloadErrorModalVisible, setIsDownloadErrorModalVisible] = useState(false);
const [isRejectEducationalModalVisible, setIsRejectEducationalModalVisible] = useState(false);
const [isHoldEducationalModalVisible, setIsHoldEducationalModalVisible] = useState(false);
const [rejectModalAction, setRejectModalAction] = useState<'hold' | 'reject' | null>(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD|CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT here instead of 'hold' | 'reject'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did try to use the CONST but I was getting type errors. I tried ValueOf and a few other things but those were giving lint errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can do something like

const [rejectModalAction, setRejectModalAction] = useState<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD | typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT> | null>(null);

@melvin-bot
Copy link

melvin-bot bot commented Nov 10, 2025

We did not find an internal engineer to review this PR, trying to assign a random engineer to #63363 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot melvin-bot bot requested a review from luacmartins November 10, 2025 09:31
const [isDownloadErrorModalVisible, setIsDownloadErrorModalVisible] = useState(false);
const [isRejectEducationalModalVisible, setIsRejectEducationalModalVisible] = useState(false);
const [isHoldEducationalModalVisible, setIsHoldEducationalModalVisible] = useState(false);
const [rejectModalAction, setRejectModalAction] = useState<'hold' | 'reject' | null>(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can do something like

const [rejectModalAction, setRejectModalAction] = useState<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD | typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT> | null>(null);

@luacmartins
Copy link
Contributor

@mananjadhav can you please address the comment above?

@mananjadhav
Copy link
Collaborator Author

@luacmartins updated.

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

LGTM

@luacmartins luacmartins merged commit 15d2fe4 into Expensify:main Nov 12, 2025
49 of 52 checks passed
@melvin-bot melvin-bot bot added the Emergency label Nov 12, 2025
@melvin-bot
Copy link

melvin-bot bot commented Nov 12, 2025

@luacmartins looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@luacmartins
Copy link
Contributor

🤔 checks were passing when I merged

@OSBotify
Copy link
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
Copy link
Contributor

🚀 Deployed to staging by https://github.com/luacmartins in version: 9.2.58-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.2.58-3 🚀

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

{!!isHoldEducationalModalVisible && (
<HoldSubmitterEducationalModal
onClose={dismissModalAndUpdateUseHold}
onConfirm={dismissModalAndUpdateUseHold}
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR added the HoldOrRejectEducationalModal and dismissedRejectUseExplanation check to MoneyReportHeader.tsx and MoneyRequestHeader.tsx but missed adding the same logic to MoneyRequestReportActionsList.tsx, which handles the reject flow on narrow screens. It caused this issue and was fixed in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for highlighting.

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