Skip to content

Commit

Permalink
Merge pull request #50399 from nkdengineer/fix/50145
Browse files Browse the repository at this point in the history
fix: The finder page display last message text is different
  • Loading branch information
MarioExpensify authored Oct 10, 2024
2 parents 9d86f30 + 26873fe commit 8f90bf8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import * as Localize from './Localize';
import * as LoginUtils from './LoginUtils';
import ModifiedExpenseMessage from './ModifiedExpenseMessage';
import Navigation from './Navigation/Navigation';
import Parser from './Parser';
import Performance from './Performance';
import * as PersonalDetailsUtils from './PersonalDetailsUtils';
import * as PhoneNumber from './PhoneNumber';
Expand Down Expand Up @@ -571,33 +572,34 @@ function getAlternateText(option: ReportUtils.OptionData, {showChatPreviewLine =
const isAnnounceRoom = ReportUtils.isAnnounceRoom(report);
const isGroupChat = ReportUtils.isGroupChat(report);
const isExpenseThread = ReportUtils.isMoneyRequest(report);
const formattedLastMessageText = ReportUtils.formatReportLastMessageText(Parser.htmlToText(option.lastMessageText ?? ''));

if (isExpenseThread || option.isMoneyRequestReport) {
return showChatPreviewLine && option.lastMessageText ? option.lastMessageText : Localize.translate(preferredLocale, 'iou.expense');
return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageText : Localize.translate(preferredLocale, 'iou.expense');
}

if (option.isThread) {
return showChatPreviewLine && option.lastMessageText ? option.lastMessageText : Localize.translate(preferredLocale, 'threads.thread');
return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageText : Localize.translate(preferredLocale, 'threads.thread');
}

if (option.isChatRoom && !isAdminRoom && !isAnnounceRoom) {
return showChatPreviewLine && option.lastMessageText ? option.lastMessageText : option.subtitle;
return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageText : option.subtitle;
}

if ((option.isPolicyExpenseChat ?? false) || isAdminRoom || isAnnounceRoom) {
return showChatPreviewLine && !forcePolicyNamePreview && option.lastMessageText ? option.lastMessageText : option.subtitle;
return showChatPreviewLine && !forcePolicyNamePreview && formattedLastMessageText ? formattedLastMessageText : option.subtitle;
}

if (option.isTaskReport) {
return showChatPreviewLine && option.lastMessageText ? option.lastMessageText : Localize.translate(preferredLocale, 'task.task');
return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageText : Localize.translate(preferredLocale, 'task.task');
}

if (isGroupChat) {
return showChatPreviewLine && option.lastMessageText ? option.lastMessageText : Localize.translate(preferredLocale, 'common.group');
return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageText : Localize.translate(preferredLocale, 'common.group');
}

return showChatPreviewLine && option.lastMessageText
? option.lastMessageText
return showChatPreviewLine && formattedLastMessageText
? formattedLastMessageText
: LocalePhoneNumber.formatPhoneNumber(option.participantsList && option.participantsList.length > 0 ? option.participantsList.at(0)?.login ?? '' : '');
}

Expand Down

0 comments on commit 8f90bf8

Please sign in to comment.