From c2e4e208616e26ef8abc601f51182560729c2737 Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Tue, 26 Sep 2023 15:17:12 +0530 Subject: [PATCH] include task status messages in last message text --- src/libs/OptionsListUtils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 7c36fa095029..a161c4568962 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -386,6 +386,7 @@ function getLastMessageTextForReport(report) { (reportAction, key) => ReportActionUtils.shouldReportActionBeVisible(reportAction, key) && reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, ); let lastMessageTextFromReport = ''; + const lastActionName = lodashGet(lastReportAction, 'actionName', ''); if (ReportUtils.isReportMessageAttachment({text: report.lastMessageText, html: report.lastMessageHtml, translationKey: report.lastMessageTranslationKey})) { lastMessageTextFromReport = `[${Localize.translateLocal(report.lastMessageTranslationKey || 'common.attachment')}]`; @@ -396,6 +397,12 @@ function getLastMessageTextForReport(report) { lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction); } else if (ReportActionUtils.isModifiedExpenseAction(lastReportAction)) { lastMessageTextFromReport = ReportUtils.getModifiedExpenseMessage(lastReportAction); + } else if ( + lastActionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED || + lastActionName === CONST.REPORT.ACTIONS.TYPE.TASKREOPENED || + lastActionName === CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED + ) { + lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', ''); } else { lastMessageTextFromReport = report ? report.lastMessageText || '' : '';