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 2 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
2 changes: 1 addition & 1 deletion src/libs/GroupChatUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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 ?? [];
const participants = report?.participantAccountIDs?.slice(0, 5) ?? [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getGroupChatName function is called at multiple places, so we can't directly apply the slice here as it will affect the other places(eg. OptionRowLHN, ReportSettings). That creates a discrepancy in web and mobile LHN titles.
I think we can add an optional parameter something like shouldApplyLimit in this function and use it from HeaderView.

cc: @deetergp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @Pujan92, that sounds like a good solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pujan92 on it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pujan92 done

const isMultipleParticipantReport = participants.length > 1;

return participants
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 @@ -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 Down
Loading