Open IuliiaHerets opened 2 hours ago
Triggered auto assignment to @kadiealexander (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.
The removed member system message shown on the chat finder page doesn't show the user login.
That's how it's from the report lastMessageText
.
But if we see the LHN, the last message says "removed 2 users", which is different from the chat finder page's last message text. This is because, for LHN, we handle manually the invite/remove case and construct a new message for it. https://github.com/Expensify/App/blob/c7ee85b2ea207159ef85932055aced28d5d2e29a/src/libs/SidebarUtils.ts#L410-L429
But for the chat finder page, we just show the report lastMessageText
because we are not handling the invite/remove action.
https://github.com/Expensify/App/blob/c7ee85b2ea207159ef85932055aced28d5d2e29a/src/libs/OptionsListUtils.ts#L612-L697
It's confusing to have 2 sources of truth of last message which works differently between LHN and chat finder page, but in this issue, we can just copy the logic from the SidebarUtils to OptionslistUtils.getLastMessageTextForReport
.
} else if (ReportActionUtils.isInviteOrRemovedAction(lastReportAction)) {
const participants = ReportUtils.getParticipantsAccountIDsForDisplay(report);
const hasMultipleParticipants = participants.length > 1 || ReportUtils.isChatRoom(report) || ReportUtils.isPolicyExpenseChat(report) || ReportUtils.isExpenseReport(report);
const lastActorDisplayName = getLastActorDisplayName(lastActorDetails, hasMultipleParticipants);
const lastActionName = lastReportAction?.actionName ?? report?.lastActionType;
const lastActionOriginalMessage = lastReportAction?.actionName ? ReportActionUtils.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
? Localize.translate(preferredLocale, 'workspace.invite.invited')
: Localize.translate(preferredLocale, 'workspace.invite.removed');
const users = Localize.translate(preferredLocale, targetAccountIDsLength > 1 ? 'workspace.invite.users' : 'workspace.invite.user');
let alternateText = ReportUtils.formatReportLastMessageText(`${lastActorDisplayName} ${verb} ${targetAccountIDsLength} ${users}`);
const roomName = lastActionOriginalMessage?.roomName ?? '';
if (roomName) {
const preposition =
lastReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM
? ` ${Localize.translate(preferredLocale, 'workspace.invite.to')}`
: ` ${Localize.translate(preferredLocale, 'workspace.invite.from')}`;
alternateText += `${preposition} ${roomName}`;
}
return alternateText;
}
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.41-2 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
Removed members from room must be shown in search as removed with their user id.
Actual Result:
In search, room chat of 2 members and 3 members removed are shown as "removed and", "removed, , and".
Removed members from room are shown in search as removed Or with commas without user id.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/7886a078-a8fc-46e1-a505-40b78fb6447d
View all open jobs on GitHub