Skip to content

ReportActionAvatars — WorkspaceAvatar + policyID migration - #98973

Merged
roryabraham merged 2 commits into
Expensify:mainfrom
software-mansion-labs:chore/policy-avatar-migration
Aug 21, 2026
Merged

roryabraham merged 2 commits into
Expensify:mainfrom
software-mansion-labs:chore/policy-avatar-migration

Conversation

@jmusial

@jmusial jmusial commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

  • Workspace avatars in list items now resolve from a policyID instead of each page hand-building an icons array.
  • New PolicyAvatar + usePolicyIcons (subscribes to avatarURL/name only), mirroring the existing AccountAvatar + useAccountIcons pair.

Fixed Issues

$ #94587
PROPOSAL:

Tests

Precondition: Account with 2+ workspaces, but not created from that account (Testing account must never create own workspace, creating one would set it as default and kill the repro)

  1. Open app
  2. Press FAB and select "Create report"
  3. Verify workspace selection list opens and every workspace row shows its avatar next to name
  4. Verify workspace with custom avatar shows uploaded image
  5. Verify workspace without custom avatar shows default avatar
  6. Hover over workspace avatar (web) and verify tooltip shows workspace name
  7. Type into search input and verify filtered rows still show correct avatars

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 followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2026-08-20.at.17.44.54.mov
Android: mWeb Chrome
Screen.Recording.2026-08-20.at.17.46.32.mov
iOS: Native
Screen.Recording.2026-08-20.at.17.36.52.mov
iOS: mWeb Safari
Screen.Recording.2026-08-20.at.17.38.35.mov
MacOS: Chrome / Safari
Screen.Recording.2026-08-20.at.16.42.50.mov

@jmusial

jmusial commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 5d87df1d19

ℹ️ 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".

@jmusial
jmusial marked this pull request as ready for review August 20, 2026 15:47
@jmusial
jmusial requested review from a team as code owners August 20, 2026 15:47
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and sobitneupane and removed request for a team August 20, 2026 15:47
@melvin-bot

melvin-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

@sobitneupane 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 removed the request for review from a team August 20, 2026 15:47

@sobitneupane sobitneupane left a comment

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.

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The 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
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-08-21.at.18.03.26.mov
Android: mWeb Chrome
Screen.Recording.2026-08-21.at.18.01.35.mov
iOS: HybridApp
iOS: mWeb Safari
Screen.Recording.2026-08-21.at.18.21.38.mov
MacOS: Chrome / Safari
Screen.Recording.2026-08-21.at.17.51.17.mov

@melvin-bot
melvin-bot Bot requested a review from roryabraham August 21, 2026 12:40
@roryabraham
roryabraham merged commit c50f71e into Expensify:main Aug 21, 2026
41 of 46 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Aug 22, 2026
61 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.59-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Help site review: no changes required

I reviewed the changes in this PR and no updates to the help site (App/docs/articles) are required.

Why: This is a purely internal front-end refactor with no user-facing behavior change. It migrates workspace avatars in list items to resolve from a policyID (via the new PolicyAvatar component and usePolicyIcons hook) instead of each page hand-building an icons array — mirroring the existing AccountAvatar / useAccountIcons pair.

What I checked
  • Nature of the change: New connected component (src/components/Avatar/connected/PolicyAvatar.tsx) and hook (src/components/Avatar/connected/usePolicyIcons.ts), plus call-site simplifications across workspace selection pages. These are architectural/code-organization changes.
  • No new features, settings, tabs, or workflows were added — nothing a help article documents.
  • No user-facing copy was introduced. The only strings touched are existing data being passed through (policy.name, policy.title), not new UI text.
  • Test plan confirms parity: the PR's steps verify that workspace avatars still render the same way (custom avatar, default avatar, tooltip, filtered rows) — i.e. this is a no-visible-change refactor validated against existing behavior.

Help articles under App/docs/articles document product features and customer-facing workflows. Since this PR changes only how avatars are resolved under the hood — with no observable change for users — there is nothing to add or update there.

No draft PR was created since there is nothing to document.


view run

@jponikarchuk

jponikarchuk commented Aug 24, 2026 •

Copy link
Copy Markdown

@jmusial @sobitneupane Could you please confirm if we should use an account with 2+ workspaces with no default WS? Workspace selection list does not appear when creating a report if one of the WS is set as default.

Bug7240352_1787436080684.bugg.mp4

@jmusial

jmusial commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

@jmusial @sobitneupane Could you please confirm if we should use an account with 2+ workspaces with no default WS? Workspace selection list does not appear when creating a report if one of the WS is set as default.

Hey I'm not sure if there are more preconditions. In my setup I have more workspaces + default set. Assumed 2+ should be enough.

Screen.Recording.2026-08-24.at.15.26.58.mov

@jponikarchuk

Copy link
Copy Markdown

This PR failing because of the issue #99334
This issue is reproducible in: All platforms

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.59-5 🚀

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

Bundle Size Analysis (Sentry):

@m-natarajan

m-natarajan commented Sep 2, 2026 •

Copy link
Copy Markdown

Validation passed Web/Chrome, v9.4.67-0, iPhone13/iOS26.2, v9.4.65-3

Recording.3467.mp4
ScreenRecording_09-02-2026.17-59-43_1.MP4

@jmusial

jmusial commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor Author

@m-natarajan I heard that there were still issues with getting workspace list step of repro working.

Please see the vid below hope that'd help 😄

Screen.Recording.2026-09-04.at.10.06.22.mov

@m-natarajan

Copy link
Copy Markdown

@jmusial Thanks for the video, It didn't work for me. Is this domain related? Am I missing anything here?

Recording.3472.mp4

@m-natarajan

Copy link
Copy Markdown

@jmusial I just created workspace and set as default for the invited account, Able to see select workspace. Can you check on your side?

Recording.3475.mp4

@jmusial

jmusial commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@m-natarajan maybe it's applauses domain thing? Just checked with regular gmail account and got the selector.

Can you try following:
Selector appears when - all need 2+ eligible workspaces, then ANY of:

  • default workspace unset / personal / deleted / not eligible
  • default eligible but billing-restricted (owner past due + past grace period)
  • 3+ eligible workspaces AND default is not among the first 2 This seems to be a bug but I would need confirmation, please see vid below
Screen.Recording.2026-09-07.at.14.40.19.mov

@m-natarajan

Copy link
Copy Markdown

@jmusial

Can you please clarify the preconditions for this "default workspace unset / personal / deleted / not eligible"

Selector appears when default workspace is billing-restricted (owner past due + past grace period)

Recording.3489.mp4

3+ eligible workspaces AND default is not among the first 2 This seems to be a bug but I would need confirmation, please see vid below

Able to reproduce this

Recording.3490.mp4

@jmusial

jmusial commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@m-natarajan

@ vid 1 interesting - meybe because it's 3 workspaces it falls under scenario 3 ?

TBH I'm just trying to deduce those steps from the code - I think would be best to get here someone that knows when the list should show from business or design perspective ?

cc @Expensify/design is this sth you're able to help with ? Or know someone who can ?

@shawnborton

Copy link
Copy Markdown
Contributor

What is the exact ask here? Happy to try to help, but I'm not entirely sure what you need us to do.

@m-natarajan

Copy link
Copy Markdown

@shawnborton The issue is with the PR steps: “Press FAB and select ‘Create report’ and verify the workspace selection list opens.”

I’m unable to identify clear steps to consistently reproduce this behavior. I’m trying different scenarios to determine the required conditions.

@shawnborton

Copy link
Copy Markdown
Contributor

I think you need to have multiple workspaces in your account. Then, go to the create button and create a report, and you should see the report selection screen.

@m-natarajan

Copy link
Copy Markdown

Tried that and not working. Workspace list not displayed when user is invited to multiple workspaces.

646411794-36553561-b627-4144-92b4-d42712b7f066.mp4

@shawnborton

Copy link
Copy Markdown
Contributor

Hmm any idea @jmusial ?

@jmusial

jmusial commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

@m-natarajan can you check if changing the default workspace in this account will result in you getting the list ?
If yes that's what I think is a bug.

@shawnborton that's why I started looking for someone who will know how it should work 😄 This PR just replaced avatar components didn't change any of the flow.

@m-natarajan

Copy link
Copy Markdown

@shawnborton @jmusial When I changed the default workspace to second in the list, Workspace list not displayed. For the third one the workspace list displayed.

Recording.3524.mp4

@jmusial

jmusial commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@shawnborton @jmusial When I changed the default workspace to second in the list, Workspace list not displayed. For the third one the workspace list displayed.

Recording.3524.mp4

Thx I think this is the bug then. In this case it should be a list regardless which one is default. If @shawnborton will confirm I can do a followup fix.

@shawnborton

Copy link
Copy Markdown
Contributor

I'm actually not too sure, let's see what @Expensify/product thinks (cc Tom)

@shawnborton

Copy link
Copy Markdown
Contributor

But I would think we should show the list regardless unless you are locked down on domain control.

@trjExpensify

Copy link
Copy Markdown
Contributor

The original logic for this is was:

  • If your default workspace is set to the personal workspace (i.e via Classic or having no group workspaces):
    • If you are a member of no group workspaces, prompt to upgrade.
    • If you are a member of one group type workspace, create the report on that. (We largely ignore the personal workspace in NewDot)
    • If you are a member of more than one group type workspaces, show the workspace selector first to choose which one to create the report on.

So it was essentially just a fallback mechanism for that "personal workspace is the default and we need to know which of 1+ group workspaces to create the report on" case.

It sounds like we've had to accommodate billing restriction and domain securityGroup's preferred workspace restrictions at some point, which make sense. So I'd expect that to work as follows:

  • Your default group workspace is billing restricted, but not domain restricted:

    • If you are a member of one group workspace, show the billing restriction modal.
    • If you are a member of more than one group workspace, show the workspace selector first.
      • If you pick a billing restricted workspace, show the billing restriction modal.
      • If you pick a non-billing restricted workspace, allow creating the report on that.
  • Your default group workspace is domain restricted, but not billing restricted:

    • Don't show the selector, regardless of how many workspaces you are a member of.
  • Your default group workspace is billing restricted and domain restricted:

    • Don't show the selector, regardless of how many workspaces you are a member of.
    • Show the billing restriction modal.

@jmusial

jmusial commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@trjExpensify cc. @m-natarajan

The original logic for this is was:

  • If your default workspace is set to the personal workspace (i.e via Classic or having no group workspaces):
    • If you are a member of no group workspaces, prompt to upgrade.
    • If you are a member of one group type workspace, create the report on that. (We largely ignore the personal workspace in NewDot)
    • If you are a member of more than one group type workspaces, show the workspace selector first to choose which one to create the report on.

✅ Matches code.

  • Your default group workspace is billing restricted, but not domain restricted:
    • If you are a member of one group workspace, show the billing restriction modal.
    • If you are a member of more than one group workspace, show the workspace selector first.
      • If you pick a billing restricted workspace, show the billing restriction modal.
      • If you pick a non-billing restricted workspace, allow creating the report on that.

✅ Matches code.

  • Your default group workspace is domain restricted, but not billing restricted:
    • Don't show the selector, regardless of how many workspaces you are a member of.

🔴 IN CODE: the app does not look at domain restrictions at all when creating a report. A domain-restricted user gets the same behaviour as an unrestricted one: the selector still shows up in the same situations, and it lists every workspace they belong to.

  • Your default group workspace is billing restricted and domain restricted:
    • Don't show the selector, regardless of how many workspaces you are a member of.
    • Show the billing restriction modal.

🔴 IN CODE: if the user belongs to more than one workspace, the app shows the workspace selector instead of the billing restriction modal. The modal only appears when the user belongs to exactly one workspace.

Additional

🔴 IN CODE: if the default is an eligible group workspace but it is the 3rd+ entry in the policy list, the FAB shows the selector instead of creating directly. FAB only, search router and Reports empty view are not affected.

I'm gonna prep a follow up fix to align all the 🔴.

@jmusial jmusial mentioned this pull request Sep 17, 2026
38 tasks done
@trjExpensify

Copy link
Copy Markdown
Contributor

I'm gonna prep a follow up fix to align all the 🔴.

Nice one, thanks! 👍

@jmusial

jmusial commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

@MelvinBot please create a followup issue based on this comment and assign me to it

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Follow-up issue created and assigned to you: Create report workspace selector ignores domain restrictions and misfires on the FAB

It captures all three 🔴 items from your comment, with trjExpensify's intended spec quoted up front and each gap pinned to code:

No existing open or recently closed issue covers this.


view run

@jmusial jmusial mentioned this pull request Oct 2, 2026
43 tasks done
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.

9 participants