refactor function getGroupChatName to use data from useOnyx part 1#95385
refactor function getGroupChatName to use data from useOnyx part 1#95385daledah wants to merge 9 commits into
Conversation
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.
|
|
@DylanDylann 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] |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a11a1e51a
ℹ️ 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".
|
@DylanDylann i updated |
| /** | ||
| * 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; | ||
| } |
There was a problem hiding this comment.
@daledah Could you explain why do we need to handle like this? It looks more complicated
There was a problem hiding this comment.
@DylanDylann pendingChatMembers is an append-only array - when a user is removed and then re-invited while offline, both a DELETE and a subsequent ADD entry exist for the same accountID.
Example: [{accountID: '1', pendingAction: 'delete'}, {accountID: '1', pendingAction: 'add'}] - member 1 should not be excluded from the group name because the latest action is add.
Explanation of Change
Fixed Issues
$ #66421
PROPOSAL:
Tests
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-07-07.at.15.32.54.mov