Repository navigation
[Payment due @linhvovan29546] Exclude non-manageable agents from workspace invite list #104110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yuwenmemon
merged 12 commits into
Expensify:main
from
s77rt:company-agent-authorize-invite-to-workspace
Oct 22, 2026
+72
−10
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
364054b
prepare logic for includeAgentsOnly
s77rt c8a6bd3
add logic for includeAgentsOnly
s77rt 886b3f8
Merge branch 'main' into company-agent-authorize-invite-to-workspace
s77rt c6d106b
calculate managedAgentsAccountIDs outside onyx selector
s77rt 34c5b11
lint
s77rt 7ef0642
extend test to cover includeAgentsOnly
s77rt 5f8c14c
rename includeAgentsOnly to agentsWhitelist
s77rt 860bbd2
use useAgent instead of useOnyx
s77rt 7b9bba6
add filterAgentsPersonalDetailsByAccountIDs
s77rt a28079c
update comment
s77rt 0e5d1c9
spellcheck
s77rt 3bbc2f3
add beta badge to workspace agents
s77rt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ const PERSONAL_DETAILS: PersonalDetailsList = Object.fromEntries( | |
| {accountID: 2, login: '[email protected]', displayName: 'Member'}, | ||
| {accountID: 3, login: '[email protected]', displayName: 'Outsider'}, | ||
| {accountID: 4, login: '[email protected]', displayName: 'Other'}, | ||
| {accountID: 5, login: '[email protected]', displayName: 'Agent A', isCustomAgent: true}, | ||
| {accountID: 6, login: '[email protected]', displayName: 'Agent B', isCustomAgent: true}, | ||
| ].map((personalDetail) => [personalDetail.accountID, personalDetail]), | ||
| ); | ||
|
|
||
|
|
@@ -38,8 +40,8 @@ function Wrapper({children}: {children: React.ReactNode}) { | |
| ); | ||
| } | ||
|
|
||
| const renderOptions = async (includeLoginsOnly?: Set<string>) => { | ||
| const {result} = renderHook(() => usePersonalDetailOptions({includeLoginsOnly}), {wrapper: Wrapper}); | ||
| const renderOptions = async (includeLoginsOnly?: Set<string>, agentsWhitelist?: Set<number>) => { | ||
| const {result} = renderHook(() => usePersonalDetailOptions({includeLoginsOnly, agentsWhitelist}), {wrapper: Wrapper}); | ||
| await waitForBatchedUpdatesWithAct(); | ||
| return result; | ||
| }; | ||
|
|
@@ -73,7 +75,14 @@ describe('usePersonalDetailOptions', () => { | |
| it('builds an option for every personal detail when no allowlist is given', async () => { | ||
| const result = await renderOptions(); | ||
|
|
||
| expect(loginsOf(result.current.options)).toEqual(['[email protected]', '[email protected]', '[email protected]', '[email protected]']); | ||
| expect(loginsOf(result.current.options)).toEqual([ | ||
| '[email protected]', | ||
| '[email protected]', | ||
| '[email protected]', | ||
| '[email protected]', | ||
| '[email protected]', | ||
| '[email protected]', | ||
| ]); | ||
| expect(result.current.currentOption?.login).toBe(CURRENT_USER_EMAIL); | ||
| expect(result.current.isLoading).toBe(false); | ||
| }); | ||
|
|
@@ -103,4 +112,16 @@ describe('usePersonalDetailOptions', () => { | |
| expect(result.current.options).toEqual([]); | ||
| expect(result.current.isLoading).toBe(false); | ||
| }); | ||
|
|
||
| it('excludes agents not in agents allow list', async () => { | ||
| const result = await renderOptions(undefined, new Set([5])); | ||
|
|
||
| expect(loginsOf(result.current.options)).toEqual(['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]']); | ||
| }); | ||
|
|
||
| it('excludes all agents if allow list is empty', async () => { | ||
| const result = await renderOptions(undefined, new Set()); | ||
|
|
||
| expect(loginsOf(result.current.options)).toEqual(['[email protected]', '[email protected]', '[email protected]', '[email protected]']); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB:
memoizedCreateOptionListhasmaxSize: 1, and the invite page now always requests a narrowed list, so switching between this page and any full-list consumer rebuilds the whole option list each time. Probably fine, but the doc comment abovememoizedCreateOptionListonly mentionsincludeLoginsOnlyevicting the whole-list entry. Can we mentionincludeAgentsOnlytoo?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated comment