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

Group - Hover profile of group 6+ members, the tooltip displays five members without ellipsis #56582

Open
2 of 8 tasks
IuliiaHerets opened this issue Feb 8, 2025 · 3 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@IuliiaHerets
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.0.95-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Issue reported by: Applause Internal Team
Device used: Win 11/Chrome
App Component: Chat Report View

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Click on group chat having 6+ members
  3. Hover over profile

Expected Result:

Hover over profile, the tooltip should display five members and ellipsis

Actual Result:

Hover over profile, the tooltip is displaying five members as this group only having 5 members

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6736754_1738976735798.Recording__900.mp4

View all open jobs on GitHub

@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 8, 2025
Copy link

melvin-bot bot commented Feb 8, 2025

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@Shahidullah-Muffakir
Copy link
Contributor

Shahidullah-Muffakir commented Feb 8, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-02-08 19:21:33 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

we are only showing 5 users names in the group chat when user hovers over the avatar, but we are not adding the ellipsis for the rest of the names

What is the root cause of that problem?

  1. we are not considering ellipsis here if the the length is more than 5:
    participantAccountIDs = participantAccountIDs.slice(0, 5);

What changes do you think we should make in order to solve the problem?

  1. we can create a variable like
let shouldUseEllipsis = false;
  1. and here when the length is more than 5 then show ellipsis:

    App/src/libs/ReportUtils.ts

    Lines 2583 to 2585 in 631006e

    if (shouldApplyLimit) {
    participantAccountIDs = participantAccountIDs.slice(0, 5);
    }

    as:
    if (shouldApplyLimit) {
        if(participantAccountIDs.length > 5) {
            shouldUseEllipsis = true;
        }
        participantAccountIDs = participantAccountIDs.slice(0, 5);
    }
  1. add the ... in the end here:

    App/src/libs/ReportUtils.ts

    Lines 2588 to 2597 in 631006e

    if (isMultipleParticipantReport) {
    return participantAccountIDs
    .map(
    (participantAccountID, index) =>
    getDisplayNameForParticipant({accountID: participantAccountID, shouldUseShortForm: isMultipleParticipantReport}) || formatPhoneNumber(participants?.[index]?.login ?? ''),
    )
    .sort((first, second) => localeCompare(first ?? '', second ?? ''))
    .filter(Boolean)
    .join(', ');
    }

    as:
               .join(', ') + (shouldUseEllipsis ? '...' : '');

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA

What alternative solutions did you explore? (Optional)

If we want the ellipsis to be added only in the HeaderView, then:

  1. we can pass a new param like showEllipsis to the getIcons here:
    const icons = getIcons(reportHeaderData, personalDetails, null, '', -1, policy, invoiceReceiverPolicy);
  2. Then pass it here to the getGroupChatName:

    App/src/libs/ReportUtils.ts

    Lines 2764 to 2772 in 631006e

    if (isGroupChat(report)) {
    const groupChatIcon = {
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    source: report.avatarUrl || getDefaultGroupAvatar(report.reportID),
    id: -1,
    type: CONST.ICON_TYPE_AVATAR,
    name: getGroupChatName(undefined, true, report),
    };
    return [groupChatIcon];
  3. and then only add the ellipsis based on this new param
Screen.Recording.2025-02-09.at.12.39.14.AM.mov

The alternative approach will work if we don't want the ellipsis in the details page as shown:

Image

@daledah
Copy link
Contributor

daledah commented Feb 9, 2025

Proposal

Please re-state the problem that we are trying to solve in this issue.

Group - Hover profile of group 6+ members, the tooltip displays five members without ellipsis

What is the root cause of that problem?

If the report has multiple participants we're get the first 5 first participants, then concat them in a single report name

App/src/libs/ReportUtils.ts

Lines 2583 to 2597 in 631006e

if (shouldApplyLimit) {
participantAccountIDs = participantAccountIDs.slice(0, 5);
}
const isMultipleParticipantReport = participantAccountIDs.length > 1;
if (isMultipleParticipantReport) {
return participantAccountIDs
.map(
(participantAccountID, index) =>
getDisplayNameForParticipant({accountID: participantAccountID, shouldUseShortForm: isMultipleParticipantReport}) || formatPhoneNumber(participants?.[index]?.login ?? ''),
)
.sort((first, second) => localeCompare(first ?? '', second ?? ''))
.filter(Boolean)
.join(', ');
}

What changes do you think we should make in order to solve the problem?

We have 2 issues here:

  1. The group name doesn't have the ellipsis style
  2. If the participant's display name/login name is too long, then when the user opens the group name settings, this may cause an error without any changes as we limit the maximum name length to 100 characters
Image

We should truncate the group name in

.join(', ');

.join(', ').slice(0, 97) + '...'

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

Test the getGroupChatName function to verify the output length is less than or equal 100 characters

What alternative solutions did you explore? (Optional)

We can also add the flag to enable/disable this feature in the specific page

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2
Projects
None yet
Development

No branches or pull requests

4 participants