Skip to content

Stop calling AddWorkEmail from workspace card flows#91885

Closed
blimpich wants to merge 6 commits into
mainfrom
blimpich-cardFlowRemoveAddWorkEmail
Closed

Stop calling AddWorkEmail from workspace card flows#91885
blimpich wants to merge 6 commits into
mainfrom
blimpich-cardFlowRemoveAddWorkEmail

Conversation

@blimpich
Copy link
Copy Markdown
Contributor

@blimpich blimpich commented May 27, 2026

Explanation of Change

If you're an admin of two workspaces and want to share a card feed from one to the other, the app needs you to have a work email on file. Until now, that flow ran a backend command that was only meant for onboarding — and that command had a security bug where it would swap your primary email to whatever you typed in, no magic code required.

The backend fix for that bug (Auth PR #21732) is already in production. But it left two screens in the App still calling the broken command, which now fail silently when you hit submit. That's been broken in production for about a week.

This PR replaces those two screens with a small explainer page that tells you to add a work email in your Contact Methods, then sends you to your Contact Methods list with a single button click. From there you tap "New contact method" and go through the standard magic-code flow (which also handles the case where your primary email isn't yet validated). After you've added and verified the email, you come back to the workspace and the feed links normally.

The onboarding side of the same cleanup is in App PR #91142.

Slack thread with the original report and discussion: https://expensify.slack.com/archives/C03TQ48KC/p1779124141564419

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/638726
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

N/A — navigation change with no new network behavior.

QA Steps

Run all steps on https://staging.new.expensify.com against staging.

Public-domain primary with no work-email secondary (most common case)

  1. Sign in as a user whose primary login is on a public domain (e.g. a gmail.com account) with no validated work-email secondary.
  2. Open a workspace that has company cards enabled.
  3. Open the "Change feed" / company-cards feed selector and pick a feed listed under "From other workspaces".
  4. Verify the user is taken to an explainer page titled "Add your work email" with a description and an "Open Contact Methods" button.
  5. Tap the button and verify the user lands on Settings > Contact methods (the list page, not the "new contact method" form).
  6. Tap "New contact method". If the primary login is not yet validated, verify the user is routed through the verify-primary flow first; otherwise the user proceeds to the magic-code prompt sent to the primary.
  7. Enter a private-domain work email, enter the magic code sent to it, finish validation.
  8. Navigate back to the workspace and reopen the feed selector; pick the same "other workspace" feed.
  9. Verify the feed links successfully (selector closes; feed is now the active feed).

Public-domain primary with a validated work-email secondary

  1. Sign in as a user whose primary is public-domain but who already has a validated private-domain secondary login.
  2. Open the company-cards feed selector and pick a feed listed under "From other workspaces".
  3. Verify the feed links directly — no explainer page, no Settings redirect, no verify-work-email page.

Unvalidated private-domain primary with no secondaries (existing verify-primary flow)

  1. Sign in as a user whose primary is a private-domain email that is not yet validated.
  2. Open the company-cards feed selector and pick a feed under "From other workspaces".
  3. Verify the user is taken to WorkspaceVerifyWorkAccountPage (existing verify-primary flow) and that entering the magic code sent to the primary links the feed.

Validated private-domain primary (no redirect needed)

  1. Sign in as a user whose primary is a validated private-domain email.
  2. Open the feed selector and pick an "other workspace" feed.
  3. Verify the feed links directly without any redirect.

Repeat all four scenarios against Expensify Card ("Add card feed" from the Expensify Card feed selector — same expected behavior on each).

Regression — onboarding still works

  1. Sign up as a new user with a public-domain email.
  2. On the onboarding "Add your work email" screen, submit a private-domain email.
  3. Verify the onboarding flow proceeds normally (this PR does not modify the onboarding caller).
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that 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
    • 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

– written by Claude on Ben's behalf

  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
  • I verified that component internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videosundefined

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

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

Files with missing lines Coverage Δ
src/ONYXKEYS.ts 100.00% <ø> (ø)
...gation/AppNavigator/ModalStackNavigators/index.tsx 6.95% <0.00%> (ø)
...panyCards/WorkspaceCompanyCardFeedSelectorPage.tsx 0.00% <0.00%> (ø)
...ifyCard/WorkspaceExpensifyCardFeedSelectorPage.tsx 0.00% <0.00%> (ø)
...ace/cardFeed/WorkspaceCardFeedAddWorkEmailPage.tsx 0.00% <0.00%> (ø)
... and 33 files with indirect coverage changes

@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 a6cf5c09960..a8302095d75 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -5454,6 +5454,7 @@ _Für ausführlichere Anweisungen [besuchen Sie unsere Hilfeseite](${CONST.NETSU
             },
             deletedCard: 'Gelöschte Karte',
             assignNewCards: {title: 'Neue Karten zuweisen', description: 'Holen Sie die neuesten Karten zum Zuweisen von Ihrer Bank'},
+            openContactMethods: 'Kontaktmethoden öffnen',
         },
         expensifyCard: {
             issueAndManageCards: 'Geben Sie Expensify Karten aus und verwalten Sie sie',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 771b34f7457..419429b6e5a 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -5131,7 +5131,7 @@ ${amount} para ${merchant} - ${date}`,
             fromOtherWorkspaces: 'De otros espacios de trabajo',
             addWorkEmail: 'Añade tu correo electrónico de trabajo',
             addWorkEmailDescription: 'Por favor, añade tu correo de trabajo para poder usar los feeds existentes de otros espacios de trabajo.',
-            openContactMethods: 'Abrir Métodos de contacto',
+            openContactMethods: 'Abrir métodos de contacto',
             error: {
                 workspaceFeedsCouldNotBeLoadedTitle: 'Error al cargar las fuentes de tarjetas del espacio de trabajo',
                 workspaceFeedsCouldNotBeLoadedMessage:
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index eb8b2d3b96f..8876871b0f7 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -5465,6 +5465,7 @@ _Pour des instructions plus détaillées, [visitez notre site d’aide](${CONST.
             },
             deletedCard: 'Carte supprimée',
             assignNewCards: {title: 'Assigner de nouvelles cartes', description: 'Obtenez les dernières cartes à assigner depuis votre banque'},
+            openContactMethods: 'Ouvrir les moyens de contact',
         },
         expensifyCard: {
             issueAndManageCards: 'Émettre et gérer vos Cartes Expensify',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 8b55789d977..a9edf94fb59 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -5435,6 +5435,7 @@ _Per istruzioni più dettagliate, [visita il nostro sito di assistenza](${CONST.
             },
             deletedCard: 'Carta eliminata',
             assignNewCards: {title: 'Assegna nuove carte', description: 'Ottieni le ultime carte da assegnare dalla tua banca'},
+            openContactMethods: 'Apri metodi di contatto',
         },
         expensifyCard: {
             issueAndManageCards: 'Emetti e gestisci le tue Carte Expensify',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 7dadd52e680..7502dce01c0 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -5385,6 +5385,7 @@ _詳しい手順については、[ヘルプサイトをご覧ください](${CO
             },
             deletedCard: '削除されたカード',
             assignNewCards: {title: '新しいカードを割り当てる', description: '銀行から割り当て可能な最新のカードを取得します'},
+            openContactMethods: '連絡方法を開く',
         },
         expensifyCard: {
             issueAndManageCards: 'Expensify カードを発行して管理する',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 9a7bb8d0ffb..f14dda4eb9c 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -5426,6 +5426,7 @@ _Voor meer gedetailleerde instructies, [bezoek onze help-site](${CONST.NETSUITE_
             },
             deletedCard: 'Verwijderde kaart',
             assignNewCards: {title: 'Nieuwe kaarten toewijzen', description: 'Haal de nieuwste kaarten op om toe te wijzen vanuit je bank'},
+            openContactMethods: 'Contactmethoden openen',
         },
         expensifyCard: {
             issueAndManageCards: 'Geef Expensify Kaarten uit en beheer ze',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index f4011e201ee..d3cdb810405 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -5415,6 +5415,7 @@ _Aby uzyskać bardziej szczegółowe instrukcje, [odwiedź naszą stronę pomocy
             },
             deletedCard: 'Usunięta karta',
             assignNewCards: {title: 'Przydziel nowe karty', description: 'Pobierz z banku najnowsze karty do przypisania'},
+            openContactMethods: 'Otwórz metody kontaktu',
         },
         expensifyCard: {
             issueAndManageCards: 'Wydawaj i zarządzaj Kartami Expensify',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index da031573508..01146c41ba4 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -5418,6 +5418,7 @@ _Para instruções mais detalhadas, [visite nossa central de ajuda](${CONST.NETS
             },
             deletedCard: 'Cartão excluído',
             assignNewCards: {title: 'Atribuir novos cartões', description: 'Obtenha do seu banco os cartões mais recentes para atribuir'},
+            openContactMethods: 'Abrir métodos de contato',
         },
         expensifyCard: {
             issueAndManageCards: 'Emita e gerencie seus Cartões Expensify',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index ea9c4e85483..828992efca6 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -5290,6 +5290,7 @@ _如需更详细的说明,请[访问我们的帮助网站](${CONST.NETSUITE_IM
             },
             deletedCard: '已删除的卡片',
             assignNewCards: {title: '分配新卡', description: '从您的银行获取可分配的最新银行卡'},
+            openContactMethods: '打开联系方式',
         },
         expensifyCard: {
             issueAndManageCards: '发放并管理您的 Expensify 卡',

Note

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

View workflow run

blimpich added 2 commits May 27, 2026 14:17
The list page gates "add new" on primary-login validation. Going straight
to /new bypasses that and breaks for users whose primary isn't validated.
@blimpich blimpich closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants