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

[$250] Android - Search - Empty space instead of user name on search, when inviting members to room #56515

Open
2 of 8 tasks
mitarachim opened this issue Feb 7, 2025 · 6 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@mitarachim
Copy link

mitarachim commented Feb 7, 2025

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: 9.0.95-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5570851&group_by=cases:section_id&group_order=asc&group_id=296763
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12
App Component: Search

Action Performed:

  1. Open the Expensify app.
  2. Open a room chat or create one if necessary.
  3. Tap on Room header and select "Members"
  4. Tap on "Invite Members" and select some members to add.
  5. Return to inbox and tap on the search icon on the top right corner.
  6. Check the message displayed on the preview of the room.

Expected Result:

Preview of room chat on search, should display the name of the invited user or the message "Invited 1 user" when new members are invited to chat.

Actual Result:

An empty space is displayed instead of user name, on room chat preview on search, when new members are invited.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6735706_1738884924709.Empty.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021889073021511769413
  • Upwork Job ID: 1889073021511769413
  • Last Price Increase: 2025-02-10
Issue OwnerCurrent Issue Owner: @ahmedGaber93
@mitarachim mitarachim added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 7, 2025
Copy link

melvin-bot bot commented Feb 7, 2025

Triggered auto assignment to @greg-schroeder (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.

@bernhardoj
Copy link
Contributor

Proposal

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

The last message text of the room only shows invited on the search modal compared to LHN where it shows how many users are invited.

What is the root cause of that problem?

For LHN, we have a logic to build the last message when it's an invite/remove action.

} else if (isInviteOrRemovedAction(lastAction)) {
const lastActionOriginalMessage = lastAction?.actionName ? getOriginalMessage(lastAction) : null;
const targetAccountIDs = lastActionOriginalMessage?.targetAccountIDs ?? [];
const targetAccountIDsLength = targetAccountIDs.length !== 0 ? targetAccountIDs.length : report.lastMessageHtml?.match(/<mention-user[^>]*><\/mention-user>/g)?.length ?? 0;
const verb =
lastActionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastActionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM
? translate(preferredLocale, 'workspace.invite.invited')
: translate(preferredLocale, 'workspace.invite.removed');
const users = translate(preferredLocale, targetAccountIDsLength > 1 ? 'workspace.invite.users' : 'workspace.invite.user');
result.alternateText = formatReportLastMessageText(`${lastActorDisplayName} ${verb} ${targetAccountIDsLength} ${users}`);
const roomName = lastActionOriginalMessage?.roomName ?? '';
if (roomName) {
const preposition =
lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM
? ` ${translate(preferredLocale, 'workspace.invite.to')}`
: ` ${translate(preferredLocale, 'workspace.invite.from')}`;
result.alternateText += `${preposition} ${roomName}`;
}

But for the search modal, it uses getLastMessageTextForReport which doesn't handle invite/remove action and it will simply return the report lastMessageText which only contains invite. After refresh, it becomes invited n users.

return lastMessageTextFromReport || (report?.lastMessageText ?? '');

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

We can move the invite/remove action logic from SidebarUtils.getOptionData to getLastMessageTextForReport.

} else if (lastReportAction?.actionName && isOldDotReportAction(lastReportAction)) {
lastMessageTextFromReport = getMessageOfOldDotReportAction(lastReportAction, false);
}

} else if (isInviteOrRemovedAction(lastReportAction)) {
    const lastActionName = lastReportAction?.actionName;
    const lastActionOriginalMessage = lastReportAction?.actionName ? getOriginalMessage(lastReportAction) : null;
    const targetAccountIDs = lastActionOriginalMessage?.targetAccountIDs ?? [];
    const targetAccountIDsLength = targetAccountIDs.length !== 0 ? targetAccountIDs.length : report?.lastMessageHtml?.match(/<mention-user[^>]*><\/mention-user>/g)?.length ?? 0;
    const verb =
        lastActionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastActionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM
            ? translate(preferredLocale, 'workspace.invite.invited')
            : translate(preferredLocale, 'workspace.invite.removed');
    const users = translate(preferredLocale, targetAccountIDsLength > 1 ? 'workspace.invite.users' : 'workspace.invite.user');
    lastMessageTextFromReport = formatReportLastMessageText(`${verb} ${targetAccountIDsLength} ${users}`);

    const roomName = lastActionOriginalMessage?.roomName ?? '';
    if (roomName) {
        const preposition =
            lastActionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastActionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM
                ? ` ${translate(preferredLocale, 'workspace.invite.to')}`
                : ` ${translate(preferredLocale, 'workspace.invite.from')}`;
        lastMessageTextFromReport += `${preposition} ${roomName}`;
    }
}

This will work for LHN too because SidebarUtils.getOptionData also uses getLastMessageTextForReport.

lastMessageTextFromReport = getLastMessageTextForReport(report, lastActorDetails, policy);

Notice that I don't include the lastActorDisplayName anymore.

result.alternateText = formatReportLastMessageText(`${lastActorDisplayName} ${verb} ${targetAccountIDsLength} ${users}`);

This is because the last actor display name for OptionsListUtils is already added here, so it will be a duplicate if I keep it.

if (shouldDisplayLastActorName && lastActorDisplayName && lastMessageTextFromReport) {
lastMessageText = `${lastActorDisplayName}: ${lastMessageTextFromReport}`;
}

However, with this change, the last message will now have : if the actor is another user, for example

josh: invited 2 users

// previously on LHN
josh invited 2 users

This will be the case for both LHN and search modal. If we want to keep the previous behavior, that is without :, then we need to re-add lastActorDisplayName,

result.alternateText = formatReportLastMessageText(`${lastActorDisplayName} ${verb} ${targetAccountIDsLength} ${users}`);

and update the condition to ignore invite/remove action.

const shouldDisplayLastActorName = lastAction && lastAction.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && lastAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU;

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

We can create a test for OptionsListUtils.getLastMessageTextForReport and assert the last message text for the invite/remove action.

Copy link

melvin-bot bot commented Feb 10, 2025

@greg-schroeder Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Feb 10, 2025
@greg-schroeder greg-schroeder added the External Added to denote the issue can be worked on by a contributor label Feb 10, 2025
@melvin-bot melvin-bot bot changed the title Android - Search - Empty space instead of user name on search, when inviting members to room [$250] Android - Search - Empty space instead of user name on search, when inviting members to room Feb 10, 2025
Copy link

melvin-bot bot commented Feb 10, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021889073021511769413

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 10, 2025
Copy link

melvin-bot bot commented Feb 10, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (External)

@greg-schroeder
Copy link
Contributor

sending through to External and proposal review

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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

4 participants