Skip to content

Commit

Permalink
Merge pull request #42476 from dragnoir/41816-fix
Browse files Browse the repository at this point in the history
Fix: display last message when searching for the rooms
  • Loading branch information
youssef-lr authored Jun 3, 2024
2 parents 305af4b + bcc6d89 commit 431f528
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,22 @@ function getLastActorDisplayName(lastActorDetails: Partial<PersonalDetails> | nu
* Update alternate text for the option when applicable
*/
function getAlternateText(option: ReportUtils.OptionData, {showChatPreviewLine = false, forcePolicyNamePreview = false}: PreviewConfig) {
const report = ReportUtils.getReport(option.reportID);
const isAdminRoom = ReportUtils.isAdminRoom(report);
const isAnnounceRoom = ReportUtils.isAnnounceRoom(report);

if (!!option.isThread || !!option.isMoneyRequestReport) {
return option.lastMessageText ? option.lastMessageText : Localize.translate(preferredLocale, 'report.noActivityYet');
}
if (!!option.isChatRoom || !!option.isPolicyExpenseChat) {

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

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

if (option.isTaskReport) {
return showChatPreviewLine && option.lastMessageText ? option.lastMessageText : Localize.translate(preferredLocale, 'report.noActivityYet');
}
Expand Down

0 comments on commit 431f528

Please sign in to comment.