From bdbfb2aba33387ccc5eba79c7d0f15b1481d8501 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Thu, 30 Nov 2023 10:55:04 +0300 Subject: [PATCH 1/6] escape task title --- src/components/ReportActionItem/TaskPreview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 4e405098a2ea..59a5d1bd694d 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -83,7 +83,7 @@ function TaskPreview(props) { const isTaskCompleted = !_.isEmpty(props.taskReport) ? props.taskReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.taskReport.statusNum === CONST.REPORT.STATUS.APPROVED : props.action.childStateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.action.childStatusNum === CONST.REPORT.STATUS.APPROVED; - const taskTitle = props.taskReport.reportName || props.action.childReportName; + const taskTitle = _.escape(props.taskReport.reportName || props.action.childReportName); const taskAssigneeAccountID = Task.getTaskAssigneeAccountID(props.taskReport) || props.action.childManagerAccountID; const assigneeLogin = lodashGet(personalDetails, [taskAssigneeAccountID, 'login'], ''); const assigneeDisplayName = lodashGet(personalDetails, [taskAssigneeAccountID, 'displayName'], ''); From a7460f7f81c9999cf20964e67b6f9029dc18a51f Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Thu, 30 Nov 2023 21:10:33 +0300 Subject: [PATCH 2/6] updated getLastMessageTextForReport to return lastMessageHtml for task last comment --- src/libs/OptionsListUtils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index c616587c3983..bd55e8a6c882 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -381,6 +381,7 @@ function getLastMessageTextForReport(report) { const lastReportAction = _.find(allSortedReportActions[report.reportID], (reportAction) => ReportActionUtils.shouldReportActionBeVisibleAsLastAction(reportAction)); let lastMessageTextFromReport = ''; const lastActionName = lodashGet(lastReportAction, 'actionName', ''); + const lastChildType = lodashGet(lastReportAction, 'childType', ''); if (ReportActionUtils.isMoneyRequestAction(lastReportAction)) { const properSchemaForMoneyRequestMessage = ReportUtils.getReportPreviewMessage(report, lastReportAction, true); @@ -410,6 +411,8 @@ function getLastMessageTextForReport(report) { lastActionName === CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED ) { lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', ''); + } else if (lastChildType === CONST.REPORT.TYPE.TASK) { + lastMessageTextFromReport = report ? report.lastMessageHtml || '' : ''; } else { lastMessageTextFromReport = report ? report.lastMessageText || '' : ''; } From 613b6f7ba48decebdc9db58818df76dbfb481737 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Fri, 1 Dec 2023 11:14:18 +0300 Subject: [PATCH 3/6] added comment --- src/libs/OptionsListUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index bd55e8a6c882..f1843770df6c 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -412,6 +412,7 @@ function getLastMessageTextForReport(report) { ) { lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', ''); } else if (lastChildType === CONST.REPORT.TYPE.TASK) { + // This is because for task report action the server sends for e.g '<' while the task title is '<< Date: Wed, 6 Dec 2023 01:01:31 +0300 Subject: [PATCH 4/6] removed unnecessary fix --- src/libs/OptionsListUtils.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index a397c39582c0..209ab953c214 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -413,9 +413,6 @@ function getLastMessageTextForReport(report) { lastActionName === CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED ) { lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', ''); - } else if (lastChildType === CONST.REPORT.TYPE.TASK) { - // This is because for task report action the server sends for e.g '<' while the task title is '<< Date: Wed, 6 Dec 2023 01:02:47 +0300 Subject: [PATCH 5/6] removed unnecessary code --- src/libs/OptionsListUtils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 209ab953c214..e3b6ec77380e 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -381,7 +381,6 @@ function getLastMessageTextForReport(report) { const lastReportAction = _.find(allSortedReportActions[report.reportID], (reportAction) => ReportActionUtils.shouldReportActionBeVisibleAsLastAction(reportAction)); let lastMessageTextFromReport = ''; const lastActionName = lodashGet(lastReportAction, 'actionName', ''); - const lastChildType = lodashGet(lastReportAction, 'childType', ''); if (ReportActionUtils.isMoneyRequestAction(lastReportAction)) { const properSchemaForMoneyRequestMessage = ReportUtils.getReportPreviewMessage(report, lastReportAction, true); From bc2070c2061c78e353477eab9ddc9e5a72818bf5 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Sun, 10 Dec 2023 19:33:38 +0300 Subject: [PATCH 6/6] removed unnecessary newlines --- src/components/ReportActionItem/TaskPreview.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 0c7f7e1a2ad4..c22181fec775 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -85,9 +85,7 @@ function TaskPreview(props) { const isTaskCompleted = !_.isEmpty(props.taskReport) ? props.taskReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.taskReport.statusNum === CONST.REPORT.STATUS.APPROVED : props.action.childStateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.action.childStatusNum === CONST.REPORT.STATUS.APPROVED; - const taskTitle = _.escape(TaskUtils.getTaskTitle(props.taskReportID, props.action.childReportName)); - const taskAssigneeAccountID = Task.getTaskAssigneeAccountID(props.taskReport) || props.action.childManagerAccountID; const assigneeLogin = lodashGet(personalDetails, [taskAssigneeAccountID, 'login'], ''); const assigneeDisplayName = lodashGet(personalDetails, [taskAssigneeAccountID, 'displayName'], '');