Skip to content

[Submit] Editor role + invite flows (Wave 2)#90995

Open
abzokhattab wants to merge 22 commits into
Expensify:mainfrom
abzokhattab:akhattab/87865-editor-role-invite-flows
Open

[Submit] Editor role + invite flows (Wave 2)#90995
abzokhattab wants to merge 22 commits into
Expensify:mainfrom
abzokhattab:akhattab/87865-editor-role-invite-flows

Conversation

@abzokhattab
Copy link
Copy Markdown
Contributor

@abzokhattab abzokhattab commented May 18, 2026

Explanation of Change

Wires up the Editor role + invite flows task from Wave 2 of the Bottom-Up Submit Plan:

  • Force the Editor role on every invite to a Submit workspace via the FE override in addMembersToWorkspace (matches the backend's Policy::shareWithEmployees behavior).
  • Add Editor to WorkspaceMemberRoleList, shown only on Submit workspaces. Admin stays gated behind isPolicyAdmin, so editors cannot escalate roles.
  • Add new editors to the #admins room in buildAddMembersToWorkspaceOnyxData.
  • Default the invite role to Editor on Submit workspaces in WorkspaceInviteMessageComponent and DynamicWorkspaceInviteMessageRolePage.
  • All Submit-specific behavior is gated behind the SUBMIT_2026 beta — resolved via usePermissions() and threaded down as a canUseSubmit2026 param so the action stays pure. Beta off = no-op.
  • Add common.editor and workspace.common.editorAlternateText to en.ts (other locales follow up).

Fixed Issues

$ #87865
PROPOSAL: N/A (internal Expensify project — design doc tracked in #87865)

Tests

Same as QA Steps.

  • Verify that no errors appear in the JS console

Offline tests

N/A — the editor role override is applied optimistically and the existing offline / optimistic-data behavior of addMembersToWorkspace is preserved.

QA Steps

Pre-requisites: enable the SUBMIT_2026 beta for all test accounts (User A and User B).

  1. Create a Submit workspace and invite a member (User B).
  2. Tap the Role row — verify only Editor is shown
  3. Complete the invite and verify User B appears as Editor on the Members page.
  4. As User B (editor), open another member's Role — verify only Editor is shown

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 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: Non-en translations intentionally deferred — will be added in a follow-up.
    • 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
Screen.Recording.2026-05-19.at.06.05.36.mov
Android: mWeb Chrome
Screen.Recording.2026-05-19.at.06.08.23.mov
iOS: Native
Screen.Recording.2026-05-19.at.05.52.26.mov
iOS: mWeb Safari
Screen.Recording.2026-05-19.at.05.54.55.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-19.at.05.39.32.mov

- Force editor role for new members on Submit workspaces in addMembersToWorkspace (FE override)
- Add Editor to WorkspaceMemberRoleList (only shown on Submit workspaces)
- Add new editors to the #admins room in buildAddMembersToWorkspaceOnyxData
- Default the invite role to Editor on Submit workspaces in the invite message + role pages
- All Submit-specific behavior is gated behind the SUBMIT_2026 beta, threaded as a parameter
- Add common.editor and workspace.common.editorAlternateText (en only; other locales to follow)
- Add unit tests covering the editor override, beta gating, and #admins room membership
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 18, 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

@OSBotify
Copy link
Copy Markdown
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 d47ee109..7d948f43 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -494,6 +494,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: 'Vorheriges Jahr',
         nextYear: 'Nächstes Jahr',
         avatar: 'Avatar',
+        editor: 'Editor',
     },
     socials: {
         podcast: 'Folgen Sie uns auf Podcast',
@@ -4321,6 +4322,8 @@ ${amount} für ${merchant} – ${date}`,
                         return 'Admin';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Prüfer';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Editor';
                     case CONST.POLICY.ROLE.USER:
                         return 'Mitglied';
                     default:
@@ -4356,6 +4359,7 @@ ${amount} für ${merchant} – ${date}`,
             travelInvoicingPayableAccount: 'Reiseverbindlichkeitskonto',
             hr: 'Personalwesen',
             rooms: 'Räume',
+            editorAlternateText: 'Arbeitsbereichseinstellungen konfigurieren, ohne die Ausgaben anderer Mitglieder zu sehen.',
         },
         createdForClient: {
             title: 'Du hast einen Workspace für deinen Kunden erstellt!',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 2fce892d..79874074 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -446,6 +446,7 @@ const translations: TranslationDeepObject<typeof en> = {
         expensifyLogo: 'Logo de Expensify',
         approver: 'Aprobador',
         enterDigitLabel: ({digitIndex, totalDigits}: {digitIndex: number; totalDigits: number}) => `introducir dígito ${digitIndex} de ${totalDigits}`,
+        editor: 'Editor',
     },
     socials: {
         podcast: 'Síguenos en Podcast',
@@ -4199,12 +4200,14 @@ ${amount} para ${merchant} - ${date}`,
                 [CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO]: 'Ninguno',
                 [CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL]: 'Indirecto',
             },
-            roleName: (role) => {
+            roleName: (role?: string) => {
                 switch (role) {
                     case CONST.POLICY.ROLE.ADMIN:
-                        return 'Administrador';
+                        return 'Admin';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Auditor';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Editor';
                     case CONST.POLICY.ROLE.USER:
                         return 'Miembro';
                     default:
@@ -4242,6 +4245,7 @@ ${amount} para ${merchant} - ${date}`,
             travelInvoicing: 'Exportar Viajes de Expensify por Pagar a',
             travelInvoicingVendor: 'Proveedor de viajes',
             travelInvoicingPayableAccount: 'Cuenta por pagar de viajes',
+            editorAlternateText: 'Configura los ajustes del espacio de trabajo sin ver los gastos de otros miembros.',
         },
         createdForClient: {
             title: '¡Has creado un espacio de trabajo para tu cliente!',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 3c89403e..f7552eec 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -494,6 +494,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: 'Année précédente',
         nextYear: 'L’an prochain',
         avatar: 'Avatar',
+        editor: 'Éditeur',
     },
     socials: {
         podcast: 'Suivez-nous sur Podcast',
@@ -4330,6 +4331,8 @@ ${amount} pour ${merchant} - ${date}`,
                         return 'Administrateur';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Auditeur';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Éditeur';
                     case CONST.POLICY.ROLE.USER:
                         return 'Membre';
                     default:
@@ -4365,6 +4368,7 @@ ${amount} pour ${merchant} - ${date}`,
             travelInvoicingPayableAccount: 'Compte fournisseur déplacements',
             hr: 'RH',
             rooms: 'Salons',
+            editorAlternateText: 'Configurer les paramètres de l’espace de travail sans voir les dépenses des autres membres.',
         },
         createdForClient: {
             title: 'Vous avez créé un espace de travail pour votre client !',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 1edee698..99aeadf5 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -494,6 +494,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: 'Anno precedente',
         nextYear: "L'anno prossimo",
         avatar: 'Avatar',
+        editor: 'Editor',
     },
     socials: {
         podcast: 'Seguici su Podcast',
@@ -4307,6 +4308,8 @@ ${amount} per ${merchant} - ${date}`,
                         return 'Amministrazione';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Revisore';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Editor';
                     case CONST.POLICY.ROLE.USER:
                         return 'Membro';
                     default:
@@ -4342,6 +4345,7 @@ ${amount} per ${merchant} - ${date}`,
             travelInvoicingPayableAccount: 'Conto debiti per viaggi',
             hr: 'Risorse umane',
             rooms: 'Stanze',
+            editorAlternateText: 'Configura le impostazioni dello spazio di lavoro senza vedere le spese degli altri membri.',
         },
         createdForClient: {
             title: 'Hai creato uno spazio di lavoro per il tuo cliente!',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 1dc8f623..4b1b743b 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -493,6 +493,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: '前年',
         nextYear: '来年',
         avatar: 'アバター',
+        editor: '編集者',
     },
     socials: {
         podcast: 'ポッドキャストでフォロー',
@@ -4273,7 +4274,9 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
                     case CONST.POLICY.ROLE.ADMIN:
                         return '管理者';
                     case CONST.POLICY.ROLE.AUDITOR:
-                        return '監査人';
+                        return '監査担当者';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return '編集者';
                     case CONST.POLICY.ROLE.USER:
                         return 'メンバー';
                     default:
@@ -4309,6 +4312,7 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
             travelInvoicingPayableAccount: '旅費未払金勘定',
             hr: '人事',
             rooms: 'ルーム',
+            editorAlternateText: '他のメンバーの経費を表示せずに、ワークスペース設定を構成できます。',
         },
         createdForClient: {
             title: 'クライアントのワークスペースを作成しました!',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 9737a63f..6c02fe96 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -493,6 +493,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: 'Vorig jaar',
         nextYear: 'Volgend jaar',
         avatar: 'Avatar',
+        editor: 'Editor',
     },
     socials: {
         podcast: 'Volg ons op Podcast',
@@ -4299,9 +4300,11 @@ ${amount} voor ${merchant} - ${date}`,
             roleName: (role?: string) => {
                 switch (role) {
                     case CONST.POLICY.ROLE.ADMIN:
-                        return 'Beheerder';
+                        return 'Beheer';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Auditor';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Editor';
                     case CONST.POLICY.ROLE.USER:
                         return 'Lid';
                     default:
@@ -4337,6 +4340,7 @@ ${amount} voor ${merchant} - ${date}`,
             travelInvoicingPayableAccount: 'Reiscrediteurenrekening',
             hr: 'HR',
             rooms: 'Kamers',
+            editorAlternateText: 'Configureer werkruimte-instellingen zonder de onkosten van andere leden te zien.',
         },
         createdForClient: {
             title: 'Je hebt een werkruimte voor je klant aangemaakt!',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index fb15ccba..70a4868e 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -493,6 +493,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: 'Poprzedni rok',
         nextYear: 'W przyszłym roku',
         avatar: 'Avatar',
+        editor: 'Edytor',
     },
     socials: {
         podcast: 'Śledź nas na Podcast',
@@ -4295,6 +4296,8 @@ ${amount} dla ${merchant} - ${date}`,
                         return 'Administrator';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Audytor';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Edytor';
                     case CONST.POLICY.ROLE.USER:
                         return 'Członek';
                     default:
@@ -4330,6 +4333,7 @@ ${amount} dla ${merchant} - ${date}`,
             travelInvoicingPayableAccount: 'Konto zobowiązań z tytułu podróży',
             hr: 'HR',
             rooms: 'Pokoje',
+            editorAlternateText: 'Konfiguruj ustawienia przestrzeni roboczej bez podglądu wydatków innych członków.',
         },
         createdForClient: {
             title: 'Utworzyłeś przestrzeń roboczą dla swojego klienta!',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 018d4b28..c7832bf5 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -492,6 +492,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: 'Ano anterior',
         nextYear: 'Ano que vem',
         avatar: 'Avatar',
+        editor: 'Editor',
     },
     socials: {
         podcast: 'Siga-nos no Podcast',
@@ -4297,6 +4298,8 @@ ${amount} para ${merchant} - ${date}`,
                         return 'Admin';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return 'Auditor';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return 'Editor';
                     case CONST.POLICY.ROLE.USER:
                         return 'Membro';
                     default:
@@ -4332,6 +4335,7 @@ ${amount} para ${merchant} - ${date}`,
             travelInvoicingPayableAccount: 'Conta a pagar de viagens',
             hr: 'RH',
             rooms: 'Salas',
+            editorAlternateText: 'Configure as configurações do espaço de trabalho sem ver as despesas de outros membros.',
         },
         createdForClient: {
             title: 'Você criou um espaço de trabalho para seu cliente!',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 7f51cc44..10041e4f 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -489,6 +489,7 @@ const translations: TranslationDeepObject<typeof en> = {
         previousYear: '上一年',
         nextYear: '明年',
         avatar: '头像',
+        editor: '编辑器',
     },
     socials: {
         podcast: '在播客上关注我们',
@@ -4206,6 +4207,8 @@ ${amount},商户:${merchant} - 日期:${date}`,
                         return '管理员';
                     case CONST.POLICY.ROLE.AUDITOR:
                         return '审计员';
+                    case CONST.POLICY.ROLE.EDITOR:
+                        return '编辑器';
                     case CONST.POLICY.ROLE.USER:
                         return '成员';
                     default:
@@ -4240,6 +4243,7 @@ ${amount},商户:${merchant} - 日期:${date}`,
             travelInvoicingPayableAccount: '差旅应付账户',
             hr: '人力资源',
             rooms: '房间',
+            editorAlternateText: '在不查看其他成员报销的情况下配置工作区设置。',
         },
         createdForClient: {
             title: '您已为客户创建了工作区!',

Note

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

View workflow run

… Profile

WorkspaceMembersPage previously bailed to ROUTES.PROFILE whenever the policy
was not isPaidGroupPolicy. Submit (submit2026) workspaces are intentionally
excluded from isPaidGroupPolicy, which made editors unable to reach the
member-details page (and therefore the Role row) for other members.

Add a canManageMembers check that includes Submit workspaces (gated on the
SUBMIT_2026 beta) so editors land on WORKSPACE_MEMBER_DETAILS like they do
on Collect/Control.
The Editor description ("Configure workspace settings without seeing other
members' expenses.") was being truncated to a single line. Match the role
list pattern used elsewhere (e.g. UpdateDelegateRolePage, SelectionScreen)
by setting alternateNumberOfSupportedLines={2}.
Previously the role list on a Submit workspace showed Editor + Member as
options. Picking Member was misleading: the FE override in
addMembersToWorkspace and the backend both force the role back to Editor
on submit2026 policies, so the user got Editor regardless.

Filter Member out alongside Admin/Auditor when the policy is Submit and
the SUBMIT_2026 beta is on — Editor is the only valid role for invites
and role-changes there.
Editor is the only valid role on a Submit workspace, so there's nothing
for the user to choose. Mark the (filtered) Editor item as
isInteractive: false so the row stays visible and informative but no
longer responds to taps.
@abzokhattab
Copy link
Copy Markdown
Contributor Author

@MelvinBot review the changes find regressions or breaking issues

@MelvinBot
Copy link
Copy Markdown
Contributor

PR Review — Potential Regressions & Issues

1. Missing canUseSubmit2026 in two buildAddMembersToWorkspaceOnyxData call sites

Report/index.ts:7686 and IOU/TrackExpense.ts:2229 both call buildAddMembersToWorkspaceOnyxData without passing canUseSubmit2026. They default to false, so members added to Submit workspaces through these paths (e.g. adding a submitter via report action, or adding an accountant during expense tracking) will not get the Editor role override.

The Report/index.ts call is the higher-risk one — it passes CONST.POLICY.ROLE.USER, so on a Submit workspace with the beta enabled, the optimistic data would briefly show the member as "Member" instead of "Editor" until the server corrects it, causing a role flash.

2. Admin role is visible but non-interactive on Submit workspaces

On Submit workspaces (isPolicySubmit2026 = true), the .map() at the end of the filter chain sets isInteractive: false on all remaining items. If the current user is a policy admin (canAssignAdminRole = true), the Admin role passes the filter, so an admin user would see both Admin and Editor — both greyed out / unselectable. This is confusing: either Admin should be filtered out on Submit workspaces, or the list should remain interactive so admins can choose.

3. Unrelated translation changes (not beta-gated)

These rename existing roles for all users, not just Submit workspaces:

  • es.ts: 'Administrador''Admin'
  • nl.ts: 'Beheerder''Beheer'
  • ja.ts: Auditor '監査人''監査担当者'

If intentional, they should be called out separately. If accidental, they'll change visible role names for Spanish, Dutch, and Japanese users across all workspace types.

4. zh-hans.ts uses "编辑器" (software editor) instead of "编辑" (person role)

编辑器 means a software editing tool (like a text editor). For a workspace role, the correct term is 编辑 or 编辑者. This affects both common.editor and the roleName switch case.

5. Redundant double role override (minor, not a bug)

addMembersToWorkspace computes effectiveRole and overrides the role to EDITOR, then passes both the already-overridden role and canUseSubmit2026 to buildAddMembersToWorkspaceOnyxData, which computes shouldForceEditorRole and overrides again (no-op). Similarly, shouldAddToAdminsRoom checks shouldForceEditorRole && effectiveRole === CONST.POLICY.ROLE.EDITOR — the second condition is always true when the first is. Not a regression, but makes the code harder to reason about.


Items #1 and #2 are the ones most likely to cause visible regressions. The rest are polish / correctness issues worth addressing before merge.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 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/libs/actions/Report/index.ts 69.39% <100.00%> (+0.01%) ⬆️
...gWorkspaceInvite/BaseOnboardingWorkspaceInvite.tsx 0.00% <ø> (ø)
src/libs/actions/Policy/Member.ts 75.87% <90.00%> (+0.05%) ⬆️
src/pages/ReportChangeWorkspacePage.tsx 0.00% <0.00%> (ø)
src/pages/workspace/MemberRightIcon.tsx 94.44% <50.00%> (-5.56%) ⬇️
...orkspace/DynamicWorkspaceInviteMessageRolePage.tsx 0.00% <0.00%> (ø)
src/pages/workspace/WorkspaceMembersPage.tsx 63.50% <66.66%> (+0.20%) ⬆️
...kspace/members/WorkspaceInviteMessageComponent.tsx 0.00% <0.00%> (ø)
src/components/WorkspaceMemberRoleList.tsx 0.00% <0.00%> (ø)
... and 6 files with indirect coverage changes

…2026 through changeReportPolicyAndInviteSubmitter

- buildAddMembersToWorkspaceOnyxData is now the single source of truth
  for the editor-role override on Submit workspaces; it returns the
  effective role so addMembersToWorkspace can use it for API params
  without duplicating the conditional.
- Simplify shouldAddToAdminsRoom: shouldForceEditorRole already implies
  effectiveRole === EDITOR, so drop the redundant equality check.
- Thread canUseSubmit2026 from ReportChangeWorkspacePage through
  changeReportPolicyAndInviteSubmitter so moving a report into a
  Submit workspace shows the correct optimistic role (no Member->Editor
  flash).
Admin doesn't exist on Submit workspaces per design — only Editor does.
Previously, if a user's role on a Submit policy happened to be Admin
(e.g. an inconsistent server response), the Admin row would still render
in the role list (just non-interactive after the read-only map). Filter
it out unconditionally on Submit so the list only ever shows Editor.
…; fix zh-hans Editor

The auto-translation diff accidentally renamed pre-existing role names
across other locales. Revert these so this PR only adds the new Editor
strings and doesn't change what existing users see for other roles:
- es: Administrador (keep — was renamed to Admin)
- nl: Beheerder (keep — was renamed to Beheer)
- ja: 監査人 (keep — was renamed to 監査担当者)

Also fix the zh-hans Editor translation:
- common.editor 编辑器 -> 编辑 (编辑器 is a software 'editor', not the
  person role)
- workspace.common.roleName(EDITOR) 编辑器 -> 编辑
- Add EDITOR case to MemberRightIcon so the role badge renders on
  the members list for Submit workspace editors.
- Simplify openMemberDetails routing in WorkspaceMembersPage: use
  canEditWorkspaceSettings (already true for editors) instead of the
  beta-gated canManageMembers, fixing the regression where clicking a
  member row opened the public Profile page instead of
  WORKSPACE_MEMBER_DETAILS.
The beta gates Submit workspace creation; it should not affect the
role list UI of an existing submit2026 workspace. Derive isPolicySubmit2026
directly from isSubmitPolicy(policy) so the Editor-only role list renders
correctly even when the SUBMIT_2026 beta is not active in the current session.
… details

The role is locked to Editor on Submit workspaces — there is nothing
to select. Marking the row as non-interactive (no chevron, no onPress)
prevents accidental navigation to WorkspaceMemberDetailsRolePage.
The full paywall/upgrade redirect for Roles is handled separately in
the Wave 2 paywall-gating issue.
@abzokhattab
Copy link
Copy Markdown
Contributor Author

abzokhattab commented May 19, 2026

Observation: workspace creator role on Submit workspaces

Per the design doc, the workspace creator should be an editor (owner), not an admin — the Admin role does not exist on Submit workspaces. Everyone including the creator should have the Editor role.

I noticed that the backend returns:

Screen.Recording.2026-05-19.at.05.43.10.mov

If the backend is returning admin for the creator, this is a backend bug that needs to be fixed in the Wave backend work (CreateWorkspace should set the creator's role to editor for submit2026 workspaces).

@abzokhattab
Copy link
Copy Markdown
Contributor Author

@MelvinBot Review the PR find other issues if any

@MelvinBot
Copy link
Copy Markdown
Contributor

Additional Review Findings

Following up on my earlier review, here are additional issues found on a deeper pass:

6. Missing Editor role badge in members list

WorkspaceMembersPage.tsx:456-463 computes roleBadgeText for Owner, Admin, and Auditor — but has no branch for CONST.POLICY.ROLE.EDITOR. On a Submit workspace, members with the Editor role will show no badge next to their name.

QA step 4 says "verify User B is shown as Editor" — but there's no visual indicator on the members list to confirm this (only the member detail page would show it via roleName).

If this is intentional (matching how USER/Member shows no badge), consider updating the QA steps. If not, add:

} else if (policyEmployee.role === CONST.POLICY.ROLE.EDITOR) {
    roleBadgeText = translate('common.editor');
}

7. No "Editors" option in the role filter dropdown

WorkspaceMembersPage.tsx:559-570 builds roleFilterOptions with All Members, Admins, and Approvers (plus Auditors for Control). There's no Editors filter added for Submit workspaces. The rolePreFilter switch (line 590) also has no case for filtering by Editor.

If all Submit members are Editors, this filter may be unnecessary — but it's a gap if admins exist alongside editors on a Submit workspace and the user wants to filter.

8. updateWorkspaceMembersRole has no Submit workspace guard

Policy/Member.ts:707-718 — unlike addMembersToWorkspace which forces the Editor role on Submit workspaces, updateWorkspaceMembersRole has no equivalent guard. This is mitigated by two UI-level blocks: (a) WorkspaceMemberRoleList sets isInteractive: false on Submit workspaces, and (b) bulk role actions are gated behind isPaidGroupPolicy. But the action itself is unguarded — any programmatic call or future UI path could bypass it.

Things that checked out fine

  • isInteractive: false is properly respected — press, keyboard, and hover are all blocked in BaseGenericPressable and BaseListItem
  • alternateNumberOfSupportedLines={2} is safe — all four role items have alternateText
  • Role draft leaking between workspaces is prevented by policyID-scoped Onyx keys + clearInviteDraft on flow start + cleanup on unmount
  • No stale closure risk with isBetaEnabled in BaseOnboardingWorkspaceInvite — the callback is not memoized
  • Failure handling is fine — failed add-member entries are removed via OfflineWithFeedback, so the role doesn't need explicit reversion

@abzokhattab
Copy link
Copy Markdown
Contributor Author

abzokhattab commented May 19, 2026

Backend bug: invited editors' roles reset to Member on re-login

After inviting a member to a Submit workspace (role correctly shows as Editor optimistically), logging out and back in causes the backend to return those members with role: user (Member) instead of role: editor.

Screen.Recording.2026-05-19.at.05.56.55.mov

Looks like its part of the Wave 1 backend task — "Update Policy::shareWithEmployees — always invite users to submit2026 policies as the editor role" — was it already implemented?

#6 — Add Editor case to roleBadgeText in WorkspaceMembersPage so the
accessibility label includes 'Editor' for Submit workspace members
(the visual badge was already correct via MemberRightIcon).

#8 — Guard updateWorkspaceMembersRole against Submit workspaces.
The UI already blocks role changes via isInteractive:false and
isPaidGroupPolicy checks, but the action itself was unguarded.
This closes the gap against future programmatic call sites.
@abzokhattab abzokhattab marked this pull request as ready for review May 19, 2026 03:13
@abzokhattab abzokhattab requested review from a team as code owners May 19, 2026 03:13
@melvin-bot melvin-bot Bot requested review from heyjennahay and hungvu193 and removed request for a team May 19, 2026 03:13
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 19, 2026

@hungvu193 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]

@abzokhattab
Copy link
Copy Markdown
Contributor Author

The PR is ready

Copy link
Copy Markdown

@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: 696bfc1a9d

ℹ️ 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 thread src/libs/actions/Policy/Member.ts
@abzokhattab
Copy link
Copy Markdown
Contributor Author

abzokhattab commented May 19, 2026

note for myself ... after this PR is merged #87833 we should make sure that the role shows the upgrade modal correctly after the current changes

}
// Editor and Member are mutually exclusive across plan types: Submit workspaces only allow Editor
// (Member would be a misleading no-op since the backend forces Editor), and other plans only allow
// Member (Editor doesn't exist there).
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.

Not sure the Member comment is necessary past the first sentence.

shouldSingleExecuteRowSelect
initiallyFocusedItemKey={availableRoleItems.find((item) => item.isSelected)?.keyForList}
addBottomSafeAreaPadding
alternateNumberOfSupportedLines={2}
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.

What is this for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it displays the role description in two lines instead of being truncated

image

Comment thread src/libs/actions/Policy/Member.ts Outdated
// caller passed. This matches the backend's behavior in Policy::shareWithEmployees so the optimistic
// updates don't briefly show the wrong role. Gated on the beta so behavior is a no-op for users without it.
const shouldForceEditorRole = canUseSubmit2026 && isSubmitPolicy(policy);
const effectiveRole = shouldForceEditorRole ? CONST.POLICY.ROLE.EDITOR : role;
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.

I don't think we need shouldForceEditorRole, we can do const effectiveRole = canUseSubmit2026 && isSubmitPolicy(policy) ? CONST.POLICY.ROLE.EDITOR : role; and just compare against CONST.POLICY.ROLE.EDITOR below.

Comment thread src/libs/actions/Policy/Member.ts Outdated
role === CONST.POLICY.ROLE.ADMIN || role === CONST.POLICY.ROLE.AUDITOR ? accountIDs : [],
);
// Admins and auditors are always in the #admins room. Editors (Submit workspaces only) join it too so they get
// visibility into configuration changes — gated on the beta to keep the room membership unchanged for non-beta users.
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.

Suggested change
// visibility into configuration changes — gated on the beta to keep the room membership unchanged for non-beta users.
// visibility into configuration changes.

Comment thread src/libs/actions/Policy/Member.ts Outdated
// Submit workspaces only allow the editor role on invite — `buildAddMembersToWorkspaceOnyxData` handles
// the override (and returns the effective role) so the optimistic data and API request stay in sync.
// The backend enforces this too (Policy::shareWithEmployees); the FE override is just to avoid a flash
// of the caller-provided role in the UI.
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.

The comment above could be more concise.

const openMemberDetails = useCallback(
(item: MemberOption) => {
if (!isPolicyAdmin || !isPaidGroupPolicy(policy)) {
if (!isPolicyAdmin) {
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.

Should this be behind the beta?

- WorkspaceMemberRoleList: shorten redundant comment; annotate
  alternateNumberOfSupportedLines={2} to explain why it is needed
- Policy/Member: remove shouldForceEditorRole variable per suggestion;
  inline condition as effectiveRole ternary; trim two verbose comments
- WorkspaceMembersPage: beta-gate openMemberDetails routing — restore
  canManageMembers guard (isPaidGroupPolicy || (canUseSubmit2026 &&
  isSubmitPolicy)) so Submit-specific routing change is a no-op when
  the beta is disabled
…/87865-editor-role-invite-flows

# Conflicts:
#	src/languages/de.ts
#	src/languages/en.ts
#	src/languages/es.ts
#	src/languages/fr.ts
#	src/languages/it.ts
#	src/languages/ja.ts
#	src/languages/nl.ts
#	src/languages/pl.ts
#	src/languages/pt-BR.ts
#	src/languages/zh-hans.ts
#	src/libs/actions/Policy/Member.ts
#	src/pages/workspace/DynamicWorkspaceInviteMessageRolePage.tsx
#	src/pages/workspace/members/WorkspaceInviteMessageComponent.tsx
@abzokhattab
Copy link
Copy Markdown
Contributor Author

abzokhattab commented May 22, 2026

I am experiencing an issue where the backend doesn't return the invited user in the list in case of a submit workspace

is it a problem with the Policy::shareWithEmployees function?

Screen.Recording.2026-05-23.at.00.58.25.mov

@carlosmiceli @iwiznia

@carlosmiceli
Copy link
Copy Markdown
Contributor

@abzokhattab got a PR up to fix it.

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.

4 participants