Skip to content

[Domain Control] [Release 4] [FE] Create MoveUsersBetweenGroupsPage#81973

Open
jmusial wants to merge 27 commits intoExpensify:mainfrom
software-mansion-labs:feat/groups-move-members
Open

[Domain Control] [Release 4] [FE] Create MoveUsersBetweenGroupsPage#81973
jmusial wants to merge 27 commits intoExpensify:mainfrom
software-mansion-labs:feat/groups-move-members

Conversation

@jmusial
Copy link
Contributor

@jmusial jmusial commented Feb 10, 2026

Explanation of Change

This PR implements a page that allows admins to bulk move selected domain members between security groups.

How it works can be previewed on desktop video at the end.

Fixed Issues

$ #80136

PROPOSAL:

Tests

  1. Open app
  2. Go to domain/domainID/members
  3. Select several members
  4. Click the primary action button and verify that the Move to group action there
  5. Select a group to move to
  6. Click Save
  7. Members should be moved (display in the table should update - but it's a part of depending PR)

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

Screen.Recording.2026-02-10.at.15.25.59.mov
Android: Native
android.mov
iOS: Native
Screen.Recording.2026-03-18.at.14.44.25.mov
MacOS: Chrome / Safari
Screen.Recording.2026-03-18.at.13.55.12.mov

@melvin-bot
Copy link

melvin-bot bot commented Feb 10, 2026

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

Comment on lines +1446 to +1454
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`,
value: {
memberErrors: {
[employeeEmail]: {errors: getMicroSecondOnyxErrorWithTranslationKey('domain.members.error.moveMember')},
},
},
},
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 update this to use the following structure: domainErrors_<domainAccountID>.memberErrors.<employeeEmail>.changeDomainSecurityGroupErrors
Please update the other occurrences as well.

Suggested change
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`,
value: {
memberErrors: {
[employeeEmail]: {errors: getMicroSecondOnyxErrorWithTranslationKey('domain.members.error.moveMember')},
},
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`,
value: {
memberErrors: {
[employeeEmail]: {changeDomainSecurityGroupErrors: getMicroSecondOnyxErrorWithTranslationKey('domain.members.error.moveMember')},
},
},
},

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, I have this BE PR open for review (for issue #82260).

Here is the result from my testing with this App PR:

image

We need to ensure that the actual error message is displayed in the member row in this App PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

The BE PR is on staging

@jmusial
Copy link
Contributor Author

jmusial commented Mar 16, 2026

Back on this should no longer be blocked

@OSBotify
Copy link
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 56eef0b6..3b0d0424 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -8643,12 +8643,16 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`,
                 removeMember: 'Dieser Benutzer kann nicht entfernt werden. Bitte versuche es erneut.',
                 addMember: 'Dieses Mitglied kann nicht hinzugefügt werden. Bitte versuche es erneut.',
                 vacationDelegate: 'Dieser Benutzer kann nicht als Urlaubsvertretung festgelegt werden. Bitte versuche es erneut.',
+                moveMember: 'Dieses Mitglied kann nicht verschoben werden. Bitte versuchen Sie es erneut.',
             },
             reportSuspiciousActivityPrompt: (email: string) =>
                 `Bist du sicher? Dadurch wird das Konto von <strong>${email}</strong> gesperrt. <br /><br /> Unser Team wird das Konto anschließend überprüfen und unbefugten Zugriff entfernen. Um den Zugriff wiederherzustellen, muss die Person mit Concierge zusammenarbeiten.`,
             reportSuspiciousActivityConfirmationPrompt: 'Wir überprüfen das Konto, um sicherzustellen, dass es sicher entsperrt werden kann, und melden uns bei Fragen über Concierge.',
             cannotSetVacationDelegateForMember: (email: string) => `Du kannst keine Urlaubsvertretung für ${email} festlegen, weil sie derzeit die Vertretung für folgende Mitglieder sind:`,
             emptyMembers: {title: 'Keine Mitglieder in dieser Gruppe', subtitle: 'Fügen Sie ein Mitglied hinzu oder versuchen Sie, den Filter oben zu ändern.'},
+            moveToGroup: 'In Gruppe verschieben',
+            chooseWhereToMove: ({count}: {count: number}) => `Wählen Sie aus, wohin Sie ${count} ${count === 1 ? 'Mitglied' : 'Mitglieder'} verschieben möchten.`,
+            move: 'Verschieben',
         },
         common: {
             settings: 'Einstellungen',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index e3141cb9..45a95304 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -8665,6 +8665,7 @@ Voici un *reçu test* pour vous montrer comment ça fonctionne :`,
                 removeMember: 'Impossible de supprimer cet utilisateur. Veuillez réessayer.',
                 addMember: 'Impossible d’ajouter ce membre. Veuillez réessayer.',
                 vacationDelegate: 'Impossible de définir cet utilisateur comme délégué de vacances. Veuillez réessayer.',
+                moveMember: 'Impossible de déplacer ce membre. Veuillez réessayer.',
             },
             cannotSetVacationDelegateForMember: (email: string) =>
                 `Vous ne pouvez pas définir un délégué de vacances pour ${email}, car cette personne est actuellement le délégué des membres suivants :`,
@@ -8673,6 +8674,9 @@ Voici un *reçu test* pour vous montrer comment ça fonctionne :`,
             reportSuspiciousActivityConfirmationPrompt:
                 'Nous examinerons le compte pour vérifier qu’il est sûr de le déverrouiller et nous vous contacterons via Concierge si nous avons des questions.',
             emptyMembers: {title: 'Aucun membre dans ce groupe', subtitle: 'Ajoutez un membre ou essayez de modifier le filtre ci-dessus.'},
+            moveToGroup: 'Déplacer vers le groupe',
+            chooseWhereToMove: ({count}: {count: number}) => `Choisissez où déplacer ${count} ${count === 1 ? 'membre' : 'membres'}.`,
+            move: 'Déplacer',
         },
         common: {
             settings: 'Paramètres',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 2814a3f5..f7292d65 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -8631,12 +8631,16 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`,
                 removeMember: 'Impossibile rimuovere questo utente. Riprova.',
                 addMember: 'Impossibile aggiungere questo membro. Riprova.',
                 vacationDelegate: 'Impossibile impostare questo utente come delegato per le ferie. Riprova.',
+                moveMember: 'Impossibile spostare questo membro. Riprova.',
             },
             cannotSetVacationDelegateForMember: (email: string) => `Non puoi impostare un delegato per le vacanze per ${email} perché al momento è il delegato per i seguenti membri:`,
             reportSuspiciousActivityPrompt: (email: string) =>
                 `Sei sicuro? Questo bloccherà l’account di <strong>${email}</strong>. <br /><br /> Il nostro team esaminerà quindi l’account e rimuoverà qualsiasi accesso non autorizzato. Per riottenere l’accesso, dovranno collaborare con Concierge.`,
             reportSuspiciousActivityConfirmationPrompt: 'Esamineremo l’account per verificare che sia sicuro sbloccarlo e ti contatteremo tramite Concierge per qualsiasi domanda.',
             emptyMembers: {title: 'Nessun membro in questo gruppo', subtitle: 'Aggiungi un membro o prova a cambiare il filtro qui sopra.'},
+            moveToGroup: 'Sposta nel gruppo',
+            chooseWhereToMove: ({count}: {count: number}) => `Scegli dove spostare ${count} ${count === 1 ? 'membro' : 'membri'}.`,
+            move: 'Sposta',
         },
         common: {
             settings: 'Impostazioni',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 1fb0fb53..18b3ecc1 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -8535,12 +8535,16 @@ ${reportName}
                 removeMember: 'このユーザーを削除できません。もう一度お試しください。',
                 addMember: 'このメンバーを追加できませんでした。もう一度お試しください。',
                 vacationDelegate: 'このユーザーを休暇代理人として設定できませんでした。もう一度お試しください。',
+                moveMember: 'このメンバーを移動できませんでした。もう一度お試しください。',
             },
             cannotSetVacationDelegateForMember: (email: string) => `${email} に休暇代理人を設定できません。現在、このユーザーは次のメンバーの代理人になっています。`,
             reportSuspiciousActivityPrompt: (email: string) =>
                 `本当によろしいですか?これにより、<strong>${email}</strong> さんのアカウントがロックされます。<br /><br />その後、当社のチームがアカウントを確認し、不正アクセスを削除します。アクセスを回復するには、Concierge と連携して対応してもらう必要があります。`,
             reportSuspiciousActivityConfirmationPrompt: 'アカウントが安全にロック解除できることを確認するために審査し、質問がある場合はConciergeを通じてご連絡します。',
             emptyMembers: {title: 'このグループにはメンバーがいません', subtitle: 'メンバーを追加するか、上のフィルターを変更してみてください。'},
+            moveToGroup: 'グループへ移動',
+            chooseWhereToMove: ({count}: {count: number}) => `${count} ${count === 1 ? 'メンバー' : 'メンバー'} を移動する先を選択してください。`,
+            move: '移動',
         },
         common: {
             settings: '設定',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 5bee400f..ba5167d5 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -8605,6 +8605,7 @@ Hier is een *proefbon* om je te laten zien hoe het werkt:`,
                 removeMember: 'Kan deze gebruiker niet verwijderen. Probeer het opnieuw.',
                 addMember: 'Kan dit lid niet toevoegen. Probeer het opnieuw.',
                 vacationDelegate: 'Kan deze gebruiker niet als vakantiemandataris instellen. Probeer het opnieuw.',
+                moveMember: 'Kan dit lid niet verplaatsen. Probeer het opnieuw.',
             },
             cannotSetVacationDelegateForMember: (email: string) =>
                 `Je kunt geen vakantiemandataris instellen voor ${email} omdat die persoon momenteel gedelegeerde is voor de volgende leden:`,
@@ -8613,6 +8614,9 @@ Hier is een *proefbon* om je te laten zien hoe het werkt:`,
             reportSuspiciousActivityConfirmationPrompt:
                 'We beoordelen de account om te verifiëren dat het veilig is om deze te ontgrendelen en nemen via Concierge contact op als we vragen hebben.',
             emptyMembers: {title: 'Geen leden in deze groep', subtitle: 'Voeg een lid toe of probeer het filter hierboven te wijzigen.'},
+            moveToGroup: 'Verplaatsen naar groep',
+            chooseWhereToMove: ({count}: {count: number}) => `Kies waar je ${count} ${count === 1 ? 'lid' : 'leden'} naartoe wilt verplaatsen.`,
+            move: 'Verplaatsen',
         },
         common: {
             settings: 'Instellingen',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 3bea0ab6..4668136c 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -8591,12 +8591,16 @@ Oto *paragon testowy*, żeby pokazać Ci, jak to działa:`,
                 removeMember: 'Nie można usunąć tego użytkownika. Spróbuj ponownie.',
                 addMember: 'Nie można dodać tego członka. Spróbuj ponownie.',
                 vacationDelegate: 'Nie można ustawić tego użytkownika jako zastępującego na czas nieobecności. Spróbuj ponownie.',
+                moveMember: 'Nie można przenieść tego członka. Spróbuj ponownie.',
             },
             cannotSetVacationDelegateForMember: (email: string) => `Nie możesz ustawić zastępstwa urlopowego dla ${email}, ponieważ jest on/ona obecnie zastępcą dla następujących członków:`,
             reportSuspiciousActivityPrompt: (email: string) =>
                 `Czy na pewno? To zablokuje konto użytkownika <strong>${email}</strong>. <br /><br /> Nasz zespół następnie przejrzy konto i usunie wszelki nieautoryzowany dostęp. Aby odzyskać dostęp, będą musieli współpracować z Concierge.`,
             reportSuspiciousActivityConfirmationPrompt: 'Przejrzymy konto, aby potwierdzić, że bezpiecznie je odblokować, i skontaktujemy się przez Concierge w razie pytań.',
             emptyMembers: {title: 'Brak członków w tej grupie', subtitle: 'Dodaj członka lub spróbuj zmienić filtr powyżej.'},
+            moveToGroup: 'Przenieś do grupy',
+            chooseWhereToMove: ({count}: {count: number}) => `Wybierz, dokąd przenieść ${count} ${count === 1 ? 'członek' : 'członkowie'}.`,
+            move: 'Przenieś',
         },
         common: {
             settings: 'Ustawienia',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index e2c3fb53..8b1a2607 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -8596,12 +8596,16 @@ Aqui está um *comprovante de teste* para mostrar como funciona:`,
                 removeMember: 'Não foi possível remover este usuário. Tente novamente.',
                 addMember: 'Não foi possível adicionar este membro. Tente novamente.',
                 vacationDelegate: 'Não foi possível definir este usuário como delegado de férias. Tente novamente.',
+                moveMember: 'Não foi possível mover este membro. Tente novamente.',
             },
             cannotSetVacationDelegateForMember: (email: string) => `Você não pode definir um procurador de férias para ${email} porque esta pessoa já é procuradora dos seguintes membros:`,
             reportSuspiciousActivityPrompt: (email: string) =>
                 `Tem certeza? Isso irá bloquear a conta de <strong>${email}</strong>. <br /><br /> Nossa equipe irá então analisar a conta e remover qualquer acesso não autorizado. Para recuperar o acesso, será necessário que trabalhem com a Concierge.`,
             reportSuspiciousActivityConfirmationPrompt: 'Vamos revisar a conta para verificar se é seguro desbloqueá-la e entraremos em contato via Concierge caso haja dúvidas.',
             emptyMembers: {title: 'Nenhum membro neste grupo', subtitle: 'Adicione um membro ou tente mudar o filtro acima.'},
+            moveToGroup: 'Mover para grupo',
+            chooseWhereToMove: ({count}: {count: number}) => `Escolha para onde mover ${count} ${count === 1 ? 'membro' : 'membros'}.`,
+            move: 'Mover',
         },
         common: {
             settings: 'Configurações',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 96415f4f..ce743100 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -8386,12 +8386,16 @@ ${reportName}
                 removeMember: '无法移除此用户。请重试。',
                 addMember: '无法添加此成员。请重试。',
                 vacationDelegate: '无法将此用户设置为休假代理人。请重试。',
+                moveMember: '无法移动此成员。请重试。',
             },
             cannotSetVacationDelegateForMember: (email: string) => `您无法为 ${email} 设置休假代理人,因为 TA 当前是以下成员的代理人:`,
             reportSuspiciousActivityPrompt: (email: string) =>
                 `你确定要这样做吗?这将锁定 <strong>${email}</strong> 的账户。<br /><br />我们的团队随后会审核该账户并移除任何未经授权的访问。若要重新获得访问权限,他们需要与 Concierge 配合处理。`,
             reportSuspiciousActivityConfirmationPrompt: '我们会审核账户以确认解锁是否安全,如有任何问题将通过 Concierge 与您联系。',
             emptyMembers: {title: '此群组中没有成员', subtitle: '添加成员或尝试更改上方的筛选条件。'},
+            moveToGroup: '移至群组',
+            chooseWhereToMove: ({count}: {count: number}) => `选择将 ${count} 个 ${count === 1 ? '成员' : '成员'} 移动到哪里。`,
+            move: '移动',
         },
         common: {
             settings: '设置',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@codecov
Copy link

codecov bot commented Mar 18, 2026

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/CONST/index.ts 95.20% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/SCREENS.ts 100.00% <ø> (ø)
src/libs/API/types.ts 100.00% <ø> (ø)
src/libs/DomainUtils.ts 100.00% <100.00%> (ø)
...avigation/linkingConfig/RELATIONS/DOMAIN_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 76.92% <ø> (ø)
src/libs/actions/Domain.ts 51.72% <100.00%> (+3.03%) ⬆️
src/ROUTES.ts 16.04% <0.00%> (-0.02%) ⬇️
...gation/AppNavigator/ModalStackNavigators/index.tsx 7.28% <0.00%> (-0.01%) ⬇️
... and 3 more
... and 17 files with indirect coverage changes

@jmusial
Copy link
Contributor Author

jmusial commented Mar 19, 2026

@codex review

@jmusial jmusial marked this pull request as ready for review March 19, 2026 09:32
@jmusial jmusial requested review from a team as code owners March 19, 2026 09:32
@melvin-bot melvin-bot bot requested review from situchan and removed request for a team March 19, 2026 09:32
@melvin-bot
Copy link

melvin-bot bot commented Mar 19, 2026

@situchan 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 JmillsExpensify and removed request for a team March 19, 2026 09:32
@jmusial jmusial requested a review from rayane-d March 19, 2026 09:44
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4ec86a443

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +1772 to +1774
[currentSecurityGroupKey]: currentSecurityGroup,
[targetSecurityGroupKey]: {
shared: {

Choose a reason for hiding this comment

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

P1 Badge Roll back only the failed account's source-group membership

When the bulk move flow iterates selected members in MoveUsersBetweenGroupsPage, every call for users from the same source group passes the same pre-move currentGroup.details snapshot. Merging that whole snapshot back here means a single failed ChangeDomainSecurityGroup request will restore all of that group's original shared members, including users whose moves already succeeded. In practice, selecting two users from one group and having only one request fail leaves the successful user back in the source group (and potentially in both groups) until the next server refresh.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@jmusial
Copy link
Contributor Author

jmusial commented Mar 24, 2026

hey @situchan when will you have time to take a look @ this ?

@situchan
Copy link
Contributor

Please merge main. Reviewing today

@MelvinBot
Copy link
Contributor

🤖 Code Review

Overall this is a clean, well-structured PR that follows existing patterns in the codebase. The optimistic/success/failure data in changeDomainSecurityGroup is solid, getMemberCustomRowProps extraction into DomainUtils is a nice refactor, and the test coverage is thorough. A few items to consider:


1. No loading/disabled state on Save button during bulk move

In MoveUsersBetweenGroupsPage.tsx, handleSave fires changeDomainSecurityGroup for each selected member in a loop, then immediately navigates back. The Save button has no isLoading prop, so a user could double-tap it before navigation completes. Consider adding a local isLoading state:

const [isLoading, setIsLoading] = useState(false);

const handleSave = () => {
    if (!selectedGroupId || !selectedMemberAccountIDs?.length || !domainName) {
        return;
    }
    setIsLoading(true);
    // ... loop and fire API calls ...
    clearDomainMembersSelectedForMove();
    Navigation.goBack(ROUTES.DOMAIN_MEMBERS.getRoute(domainAccountID));
};

// In JSX:
<Button
    success
    pressOnEnter
    text={translate('common.save')}
    onPress={handleSave}
    isDisabled={!selectedGroupId}
    isLoading={isLoading}
/>

This follows the pattern used in other domain pages to prevent double-submission.

2. getMemberCustomRowProps pending action chain might miss accountID-keyed changeDomainSecurityGroup

In DomainUtils.ts, the pending action fallback chain is:

pendingAction: emailPendingActions?.pendingAction
    ?? accountIDPendingActions?.pendingAction
    ?? accountIDPendingActions?.lockAccount
    ?? emailPendingActions?.changeDomainSecurityGroup,

Since changeDomainSecurityGroup stores pending actions under the email key (in Domain.ts), this works today. But the chain doesn't check accountIDPendingActions?.changeDomainSecurityGroup. If the backend ever responds with pending actions keyed by accountID, the move-in-progress indicator would be missed. Consider adding it for defensive consistency:

pendingAction: emailPendingActions?.pendingAction
    ?? accountIDPendingActions?.pendingAction
    ?? accountIDPendingActions?.lockAccount
    ?? emailPendingActions?.changeDomainSecurityGroup
    ?? accountIDPendingActions?.changeDomainSecurityGroup,

3. German translation formality inconsistency

The moveMember error in de.ts uses formal "Sie" ("Bitte versuchen Sie es erneut"), while all other German error strings use informal "du" ("Bitte versuche es erneut"). This should be "Dieses Mitglied kann nicht verschoben werden. Bitte versuche es erneut." for consistency.

4. Minor: Silent skip for unresolvable members

In MoveUsersBetweenGroupsPage.tsx, if getLoginByAccountID returns undefined for a selected member (personal details not loaded), the loop silently continues without any user feedback. For bulk operations this is probably acceptable, but worth noting — users won't know if some members were skipped.


Summary: The architecture and data flow are sound. The main actionable items are (1) adding a loading state to prevent double-submit and (3) the German translation formality fix. Items (2) and (4) are lower priority but worth considering for robustness.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ab351b8a9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

>
<HeaderWithBackButton
title={translate('domain.members.moveToGroup')}
onBackButtonPress={() => Navigation.goBack(ROUTES.DOMAIN_MEMBERS.getRoute(domainAccountID))}

Choose a reason for hiding this comment

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

P2 Badge Clear pending move selection on back navigation

onBackButtonPress only navigates away and never clears DOMAIN_MEMBERS_SELECTED_FOR_MOVE. Since that selection is stored in a global Onyx key and is only reset in handleSave, canceling this page leaves stale account IDs behind; when domain/:domainAccountID/members/move is opened later (especially via deeplink or after switching domains), those old IDs can be reused and trigger moves for users not selected in the current flow. Clear the selection on cancel/unmount (or scope it by domain) to prevent cross-flow state leakage.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@JmillsExpensify JmillsExpensify left a comment

Choose a reason for hiding this comment

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

Part of an existing product initiative

@jmusial
Copy link
Contributor Author

jmusial commented Mar 24, 2026

🤖 Code Review

...

1. No loading/disabled state on Save button during bulk move

Given how the code works, isLoading on the button isn't meaningfully useful here — by the time React re-renders with the new state, Navigation.goBack() has already fired and the component is unmounting. Additionally the prevention of double-submission is already in place: clearDomainMembersSelectedForMove() runs before nav, so a hypothetical second press would hit !selectedMemberAccountIDs?.length and bail out early at line 55.

2. getMemberCustomRowProps pending action chain might miss accountID-keyed changeDomainSecurityGroup

This is intentional. @rayane-d do you think we'll ever get changeDomainSecurityGroup errors keyed by accountID instead of email

3. German translation formality inconsistency

Translations from parrot

4. Minor: Silent skip for unresolvable members

Intentional

@rayane-d
Copy link
Contributor

This is intentional. @rayane-d do you think we'll ever get changeDomainSecurityGroup errors keyed by accountID instead of email

No, I don't think we'll get changeDomainSecurityGroup errors keyed by accountID instead of email. We always send them using the email.

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

Labels

None yet

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

6 participants