Skip to content

Commit

Permalink
Merge pull request #38019 from rojiphil/36866-fix-no-activity-yet
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl authored Mar 11, 2024
2 parents 0f1570b + 387ea4e commit 70bfa94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ function getLastVisibleAction(reportID: string, actionsToMerge: OnyxCollection<R
return sortedReportActions[0];
}

function getLastVisibleMessage(reportID: string, actionsToMerge: OnyxCollection<ReportAction> = {}): LastVisibleMessage {
const lastVisibleAction = getLastVisibleAction(reportID, actionsToMerge);
function getLastVisibleMessage(reportID: string, actionsToMerge: OnyxCollection<ReportAction> = {}, reportAction: OnyxEntry<ReportAction> | undefined = undefined): LastVisibleMessage {
const lastVisibleAction = reportAction ?? getLastVisibleAction(reportID, actionsToMerge);
const message = lastVisibleAction?.message?.[0];

if (message && isReportMessageAttachment(message)) {
Expand Down
5 changes: 4 additions & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,10 @@ function getOptionData({
} else if (lastAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && lastActorDisplayName && lastMessageTextFromReport) {
result.alternateText = `${lastActorDisplayName}: ${lastMessageText}`;
} else {
result.alternateText = lastMessageTextFromReport.length > 0 ? lastMessageText : Localize.translate(preferredLocale, 'report.noActivityYet');
result.alternateText = lastMessageTextFromReport.length > 0 ? lastMessageText : ReportActionsUtils.getLastVisibleMessage(report.reportID, {}, lastAction)?.lastMessageText;
if (!result.alternateText) {
result.alternateText = Localize.translate(preferredLocale, 'report.noActivityYet');
}
}
} else {
if (!lastMessageText) {
Expand Down

0 comments on commit 70bfa94

Please sign in to comment.