Skip to content

Part 3 - Audit usage of Str.removeSMSDomain - #100056

Open
FitseTLT wants to merge 3 commits into
Expensify:mainfrom
FitseTLT:fix-audit-removeSMSDomain-part-3
Open

Part 3 - Audit usage of Str.removeSMSDomain#100056
FitseTLT wants to merge 3 commits into
Expensify:mainfrom
FitseTLT:fix-audit-removeSMSDomain-part-3

Conversation

@FitseTLT

@FitseTLT FitseTLT commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The approval workflow surfaces displayed member and approver names through Str.removeSMSDomain, which only strips the @expensify.sms suffix. A phone-login user with no display name therefore rendered as a raw +15551234567 in the workflows list, the workflow editor, the approval limit page, and the "Expenses from" member selector, instead of the national format for the viewer's country.

This replaces those calls with formatPhoneNumber from useLocalize(), so the values react to the viewer's country code. Display names are guarded with Str.isSMSLogin first, because formatPhoneNumber substitutes non-breaking spaces and would break wrapping on ordinary names; logins are formatted directly, since it leaves non-phone strings unchanged. getApprovalLimitDescription takes formatPhoneNumber as an injected parameter, matching how it already receives translate and convertToDisplayString. The workflow search is left additive rather than swapped, so typing raw digits still matches alongside the newly displayed format.

Fixed Issues

$ #97957
PROPOSAL: N/A — issue owner

Tests

Setup: a workspace on a Control policy with at least four approval workflows (the search field only appears above three), at least two members whose login is a phone number and who have no display name set, so the login is what renders, plus one member with an ordinary display name.

  1. Go to Workspace settings > Workflows and enable Add approvals.
  2. Verify each workflow row shows the phone member formatted for your region rather than as a raw +15551234567, on both the "Expenses from" line and the approver line.
  3. Verify the member with an ordinary display name still shows that name unchanged.
  4. Tap a workflow to open the editor. Verify the members line and each approver row show the same formatted number.
  5. On an approver row, set an approval limit and an over-limit forward-to approver.
  6. Verify the helper text reads "Reports above $1,000 forward to ..." with the approver's number formatted rather than raw.
  7. Open the approval limit page for that approver and verify the selected approver's name is formatted there too.
  8. Go back to the workflows list. With more than three workflows present, verify the search field is shown, and use it.
  9. Search the raw digits of the phone member's login and verify the workflow still matches.
  10. Search the number exactly as it now appears in the row and verify the workflow matches.
  11. Search the email/login form and verify the workflow matches.
  12. Search part of the ordinary display name and verify that workflow still matches.
  13. Open a workflow and tap Expenses from to open the member selection list.
  14. Verify each selected and unselected member row shows a formatted number, and that the avatar tooltip/name matches.
  15. Verify the row's secondary line still shows the raw email/login.
  16. Select a member who already belongs to another workflow, so the "member already in workflow" confirmation appears.
  17. Verify the prompt names both the member and the existing approver with formatted numbers.

[x] Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • 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
2026-09-01.19-46-05.mp4

@FitseTLT
FitseTLT requested review from a team as code owners September 1, 2026 15:11
@melvin-bot
melvin-bot Bot requested review from shubham1206agra and removed request for a team September 1, 2026 15:11
@melvin-bot

melvin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

@shubham1206agra 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 heyjennahay and removed request for a team September 1, 2026 15:11
@shubham1206agra

Copy link
Copy Markdown
Contributor

@FitseTLT Fix CI checks please

@codecov

codecov Bot commented Sep 1, 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/components/ApprovalWorkflowSection.tsx 80.43% <100.00%> (+0.43%) ⬆️
src/libs/WorkflowUtils.ts 91.82% <100.00%> (+0.01%) ⬆️
...workspace/workflows/tabs/WorkflowsApprovalsTab.tsx 78.37% <100.00%> (+0.29%) ⬆️
...ace/workflows/approvals/ApprovalWorkflowEditor.tsx 79.01% <57.14%> (-1.76%) ⬇️
...s/WorkspaceWorkflowsApprovalsApprovalLimitPage.tsx 0.00% <0.00%> (ø)
...micWorkspaceWorkflowsApprovalsExpensesFromPage.tsx 0.00% <0.00%> (ø)
... and 45 files with indirect coverage changes

Comment thread tests/unit/WorkflowUtilsTest.ts Outdated
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.

2 participants