Skip to content
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

Fix - Group chat - After removing user, group name is not updated #49618

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,14 @@ function getGroupChatName(participants?: SelectedParticipant[], shouldApplyLimit
return report.reportName;
}

let participantAccountIDs = participants?.map((participant) => participant.accountID) ?? Object.keys(report?.participants ?? {}).map(Number);
const pendingMemberAccountIDs = new Set(
report?.pendingChatMembers?.filter((member) => member.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE).map((member) => member.accountID),
);
let participantAccountIDs =
participants?.map((participant) => participant.accountID) ??
Object.keys(report?.participants ?? {})
.map(Number)
.filter((accountID) => !pendingMemberAccountIDs.has(accountID.toString()));
if (shouldApplyLimit) {
participantAccountIDs = participantAccountIDs.slice(0, 5);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
const isSelfDM = ReportUtils.isSelfDM(report);
const isGroupChat = ReportUtils.isGroupChat(report) || ReportUtils.isDeprecatedGroupDM(report);

const participants = ReportUtils.getParticipantsAccountIDsForDisplay(report).slice(0, 5);
const participants = ReportUtils.getParticipantsAccountIDsForDisplay(report, false, true).slice(0, 5);
const isMultipleParticipant = participants.length > 1;

const participantPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(participants, personalDetails);
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
permissions,
invoiceReceiver: reportOnyx.invoiceReceiver,
policyAvatar: reportOnyx.policyAvatar,
pendingChatMembers: reportOnyx.pendingChatMembers,
},
[reportOnyx, permissions],
);
Expand Down
Loading