-
Notifications
You must be signed in to change notification settings - Fork 4k
refactor function getGroupChatName to use data from useOnyx part 1 #95385
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
base: main
Are you sure you want to change the base?
Changes from all commits
0a7048c
bc7ea82
85556dc
4a11a1e
807f93a
6ee89d7
7a0df0e
5ff87cb
c2c2d40
97b6764
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6326,6 +6326,31 @@ function getPendingChatMembers(accountIDs: number[], previousPendingChatMembers: | |
| return [...previousPendingChatMembers, ...pendingChatMembers]; | ||
| } | ||
|
|
||
| /** | ||
| * Returns account IDs whose latest pending action is DELETE. | ||
| * Uses `findLast` so that a subsequent ADD (e.g. re-invite while offline) takes precedence over an earlier DELETE. | ||
| */ | ||
| function getPendingDeleteMemberAccountIDs(pendingChatMembers: PendingChatMember[] | undefined): string[] { | ||
| if (!pendingChatMembers?.length) { | ||
| return []; | ||
| } | ||
|
|
||
| const seen = new Set<string>(); | ||
| const result: string[] = []; | ||
| for (const member of pendingChatMembers) { | ||
| seen.add(member.accountID); | ||
| } | ||
|
|
||
| for (const accountID of seen) { | ||
| const latestAction = pendingChatMembers.findLast((member) => member.accountID === accountID); | ||
| if (latestAction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { | ||
| result.push(accountID); | ||
| } | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
Comment on lines
+6329
to
+6352
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daledah Could you explain why do we need to handle like this? It looks more complicated
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DylanDylann Example: |
||
|
|
||
| /** | ||
| * Gets the parent navigation subtitle for the report | ||
| */ | ||
|
|
@@ -13917,6 +13942,7 @@ export { | |
| getParticipantsAccountIDsForDisplay, | ||
| getParticipantsList, | ||
| getPendingChatMembers, | ||
| getPendingDeleteMemberAccountIDs, | ||
| getPersonalDetailsForAccountID, | ||
| getPolicyDescriptionText, | ||
| getPolicyExpenseChat, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.