Skip to content

[Release 3.3] [Domain Control] Report suspicious activity#78372

Merged
mountiny merged 51 commits intoExpensify:mainfrom
software-mansion-labs:feat/domain-report-sus-activity
Mar 3, 2026
Merged

[Release 3.3] [Domain Control] Report suspicious activity#78372
mountiny merged 51 commits intoExpensify:mainfrom
software-mansion-labs:feat/domain-report-sus-activity

Conversation

@jmusial
Copy link
Contributor

@jmusial jmusial commented Dec 23, 2025

Explanation of Change

Part for Domain Control project. This PR adds reporting suspicious activity (locking users account).

Based on the design doc & discussion it resembles Report Suspicious Activity from the Settings/Account page.

Fixed Issues

$ #79568

PROPOSAL:

Tests

Pre requisites:
Have a domain and be an admin there.

  1. Open the app
  2. Go to Workspaces -> your domain -> Domain members
  3. Click on a member
  4. Click "Report suspicious activity" and confirm 2 modals
  5. Account is locked
  6. Click "Unlock account"
  7. Dismiss modal

Offline tests

QA Steps

Same as tests.

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 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
0093.android.native.mov
Android: mWeb Chrome
0093.android.chrome.mov
iOS: Native
0093.ios.native.mov
iOS: mWeb Safari
0093.ios.safari.mov
MacOS: Chrome / Safari
0093.desktop.chrome.mov

@melvin-bot
Copy link

melvin-bot bot commented Dec 23, 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 Dec 23, 2025

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 92.68% <ø> (+0.12%) ⬆️
src/SCREENS.ts 100.00% <ø> (ø)
...ents/HTMLEngineProvider/BaseHTMLEngineProvider.tsx 87.50% <100.00%> (+0.46%) ⬆️
...mponents/HTMLEngineProvider/HTMLRenderers/index.ts 100.00% <ø> (ø)
src/components/RenderHTML.tsx 100.00% <100.00%> (ø)
src/components/VacationDelegateMenuItem.tsx 0.00% <ø> (ø)
...avigation/linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 75.00% <ø> (ø)
src/libs/actions/User.ts 30.10% <100.00%> (+4.76%) ⬆️
.../pages/domain/BaseDomainMemberDetailsComponent.tsx 0.00% <ø> (ø)
... and 13 more
... and 43 files with indirect coverage changes

@jmusial jmusial changed the title Feat/domain report sus activity HOLD] [Release 2] [Domain Control] Report suspicious activity Dec 23, 2025
@jmusial jmusial changed the title HOLD] [Release 2] [Domain Control] Report suspicious activity [HOLD] [Release 2] [Domain Control] Report suspicious activity Dec 23, 2025
@jmusial jmusial changed the title [HOLD] [Release 2] [Domain Control] Report suspicious activity [HOLD] [Release 3] [Domain Control] Report suspicious activity Dec 23, 2025
@jmusial jmusial moved this to In Progress in Bring Domain Control to NewDot Jan 14, 2026
@jmusial jmusial changed the title [HOLD] [Release 3] [Domain Control] Report suspicious activity [HOLD] [Release 3.3] [Domain Control] Report suspicious activity Jan 14, 2026
}

setIsLoading(true);
const response = await lockAccount(accountID);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a domainAccountID parameter to LockAccount so that we can return Onyx data for errors

Copy link
Contributor

Choose a reason for hiding this comment

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

Related BE issue: #81420

/** Onyx prefix for domain security groups */
DOMAIN_SECURITY_GROUP_PREFIX: 'domain_securityGroup_',
/** Onyx prefix for lock account IDs */
EXPENSIFY_LOCKED_ACCOUNT_PREFIX: 'expensify_lockAccountDetails_',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
EXPENSIFY_LOCKED_ACCOUNT_PREFIX: 'expensify_lockAccountDetails_',
PRIVATE_LOCKED_ACCOUNT_PREFIX: 'private_lockAccountDetails_',

description={translate('common.vacationDelegate')}
shouldShowRightIcon
onPress={onPress}
containerStyle={styles.pr2}
Copy link
Contributor

Choose a reason for hiding this comment

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

This causes regression

Image

staging:

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the discussion on this PR I'd say the custom mr on Clear after should be adjusted instead ? cc. @Expensify/design

Copy link
Contributor

Choose a reason for hiding this comment

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

@Expensify/design What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

The staging screenshot looks more correct to me - but maybe I've missed a discussion somewhere? Let's see what the rest of @Expensify/design thinks.

resetDomainExplanation: ({domainName}: {domainName?: string}) => `Please type <strong>${domainName}</strong> to confirm the domain reset.`,
enterDomainName: 'Enter your domain name here',
resetDomainInfo: `This action is <strong>permanent</strong> and the following data will be deleted: <br/> <ul><li>Company card connections and any unreported expenses from those cards</li> <li>SAML and group settings</li> </ul> All accounts, workspaces, reports, expenses, and other data will remain. <br/><br/>Note: You can clear this domain from your domains list by removing the associated email from your <a href="#">contact methods</a>.`,
resetDomainInfo: `This action is <strong>permanent</strong> and the following data will be deleted: <br/> <bullet-list><bullet-item>Company card connections and any unreported expenses from those cards</bullet-item><bullet-item>SAML and group settings</bullet-item></bullet-list> All accounts, workspaces, reports, expenses, and other data will remain. <br/><br/>Note: You can clear this domain from your domains list by removing the associated email from your <a href="#">contact methods</a>.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems not working as expected. No longer list type:

Image

staging:

Image

Copy link
Contributor Author

@jmusial jmusial Mar 2, 2026

Choose a reason for hiding this comment

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

updated

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why it worked for closeAccountInfo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, when you pass a link to the RenderHTML it is using a different RenderHTMLConfigProvider. It does not have custom rendereres passed to it.

Before it was ok, bc the bullet list was using plain html

closeAccountInfo: () => ({
one: 'We recommend closing the account safely to skip closing it in case there are: <ul><li>Pending approvals</li><li>Active reimbursements</li><li>No alternative login methods</li></ul>Otherwise, you can ignore the safety precautions above and force close the selected account.',
other: 'We recommend closing the accounts safely to skip closing it in case there are: <ul><li>Pending approvals</li><li>Active reimbursements</li><li>No alternative login methods</li></ul>Otherwise, you can ignore the safety precautions above and force close the selected accounts.',
one: 'We recommend closing the account safely to skip closing it in case there are: <bullet-list><bullet-item>Pending approvals</bullet-item><bullet-item>Active reimbursements</bullet-item><bullet-item>No alternative login methods</bullet-item></bullet-list>Otherwise, you can ignore the safety precautions above and force close the selected account.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw was this change requested? Please share discussion link for context.

Before:

Image

After:

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mountiny
Copy link
Contributor

mountiny commented Mar 2, 2026

Just waiting for @Expensify/design on #78372 (comment)

@dubielzyk-expensify dubielzyk-expensify self-requested a review March 3, 2026 00:05
@dubielzyk-expensify
Copy link
Contributor

Visually this looks great! Approved on my end

@situchan
Copy link
Contributor

situchan commented Mar 3, 2026

Visually this looks great! Approved on my end

@dubielzyk-expensify are you saying that this inconsistency is fine?

556851821-ea985182-74ea-468d-936d-712c55b24fc9

@dubielzyk-expensify
Copy link
Contributor

No that's not fine, but that's the status screen. What's that got to do with the domain control part?

Sorry if I've missed something

@situchan
Copy link
Contributor

situchan commented Mar 3, 2026

@dubielzyk-expensify ok then, is this inconsistency fine?

Right padding is different between same components.

556851821-ea985182-74ea-468d-936d-712c55b24fc9 556851821-ea985182-74ea-468d-936d-712c55b24fc9 copy

@jmusial
Copy link
Contributor Author

jmusial commented Mar 3, 2026

@dubielzyk-expensify we had a conversation with @shawnborton above about the right padding on arrows

#78372 (comment)
#78372 (comment) <- @situchan answer to your question

And the decision was to not modify the standard MenuItem styles for our buttons.

They are modified (less margin right) in one other place in the app, and unlucky for us this place is Clear after, is why I suggested to modify this one as well here

@situchan
Copy link
Contributor

situchan commented Mar 3, 2026

@jmusial ok let's do what we landed and push the fix.

@jmusial
Copy link
Contributor Author

jmusial commented Mar 3, 2026

@jmusial ok let's do what we landed and push the fix.

Waiting for @Expensify/design to confirm before making changes

@dubielzyk-expensify
Copy link
Contributor

I'm a bit confused, but if Shawn suggested a way forward then lets go with that.

In general we don't wanna specifically tweak these components per screen. They should work the same everywhere since they're just a bunch of list components.

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Changes look good to me, I dont want to hold this one any further, we can clean up the padding on the menu item later in case we will decide that way

@mountiny mountiny merged commit 7eea908 into Expensify:main Mar 3, 2026
35 checks passed
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Bring Domain Control to NewDot Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

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

@OSBotify
Copy link
Contributor

OSBotify commented Mar 4, 2026

🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.31-0 🚀

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

@vincdargento
Copy link

Deploy Blocker #84214 was identified to be related to this PR.

@jmusial
Copy link
Contributor Author

jmusial commented Mar 5, 2026

Deploy Blocker #84214 was identified to be related to this PR.

Opened a PR with a fix

@mountiny
Copy link
Contributor

mountiny commented Mar 5, 2026

Fix cped

@OSBotify
Copy link
Contributor

OSBotify commented Mar 6, 2026

🚀 Deployed to production by https://github.com/blimpich in version: 9.3.31-12 🚀

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

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.