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 conversation header display 5 participants #38568

Merged
merged 5 commits into from
Mar 21, 2024
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
7 changes: 5 additions & 2 deletions src/libs/GroupChatUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import * as ReportUtils from './ReportUtils';
/**
* Returns the report name if the report is a group chat
*/
function getGroupChatName(report: OnyxEntry<Report>): string | undefined {
const participants = report?.participantAccountIDs ?? [];
function getGroupChatName(report: OnyxEntry<Report>, shouldApplyLimit = false): string | undefined {
let participants = report?.participantAccountIDs ?? [];
deetergp marked this conversation as resolved.
Show resolved Hide resolved
if (shouldApplyLimit) {
participants = participants.slice(0, 5);
}
const isMultipleParticipantReport = participants.length > 1;

return participants
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction,
const styles = useThemeStyles();
const isSelfDM = ReportUtils.isSelfDM(report);
// Currently, currentUser is not included in participantAccountIDs, so for selfDM, we need to add the currentUser as participants.
const participants = isSelfDM ? [session?.accountID ?? -1] : report?.participantAccountIDs ?? [];
const participants = isSelfDM ? [session?.accountID ?? -1] : (report?.participantAccountIDs ?? []).slice(0, 5);
deetergp marked this conversation as resolved.
Show resolved Hide resolved
const participantPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(participants, personalDetails);
const isMultipleParticipant = participants.length > 1;
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(participantPersonalDetails, isMultipleParticipant, undefined, isSelfDM);
Expand All @@ -89,7 +89,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction,
const isTaskReport = ReportUtils.isTaskReport(report);
const reportHeaderData = !isTaskReport && !isChatThread && report.parentReportID ? parentReport : report;
// Use sorted display names for the title for group chats on native small screen widths
const title = ReportUtils.isGroupChat(report) ? getGroupChatName(report) : ReportUtils.getReportName(reportHeaderData);
const title = ReportUtils.isGroupChat(report) ? getGroupChatName(report, true) : ReportUtils.getReportName(reportHeaderData);
const subtitle = ReportUtils.getChatRoomSubtitle(reportHeaderData);
const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(reportHeaderData);
const isConcierge = ReportUtils.hasSingleParticipant(report) && participants.includes(CONST.ACCOUNT_ID.CONCIERGE);
Expand Down
Loading