Skip to content

Commit

Permalink
Merge pull request #19990 from dukenv0307/fix/19089
Browse files Browse the repository at this point in the history
  • Loading branch information
thienlnam authored Jun 5, 2023
2 parents f104baa + c9e71d4 commit f8a0a34
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/components/ReportActionItem/TaskPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import Icon from '../Icon';
import CONST from '../../CONST';
import * as Expensicons from '../Icon/Expensicons';
import Text from '../Text';
import Checkbox from '../Checkbox';
import * as StyleUtils from '../../styles/StyleUtils';
import getButtonState from '../../libs/getButtonState';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes';
import * as TaskUtils from '../../libs/actions/Task';
import RenderHTML from '../RenderHTML';

const propTypes = {
/** The ID of the associated taskReport */
Expand Down Expand Up @@ -56,8 +56,10 @@ const TaskPreview = (props) => {
const isTaskCompleted =
(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.action.taskTitle || props.taskReport.reportName;
const parentReportID = props.action.parentReportID || props.taskReport.parentReportID;
const taskTitle = props.taskReport.reportName || props.action.childReportName;
const taskAssignee = props.taskReport.managerEmail || props.action.childManagerEmail;
const htmlForTaskPreview = taskAssignee ? `<comment><mention-user>@${taskAssignee}</mention-user> ${taskTitle}</comment>` : `<comment>${taskTitle}</comment>`;
const parentReportID = props.taskReport.parentReportID || props.action.parentReportID;

return (
<Pressable
Expand All @@ -78,7 +80,7 @@ const TaskPreview = (props) => {
}
}}
/>
<Text>{taskTitle}</Text>
<RenderHTML html={htmlForTaskPreview} />
</View>
<Icon
src={Expensicons.ArrowRight}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ function buildOptimisticTaskCommentReportAction(taskReportID, taskTitle, taskAss
reportAction.reportAction.childReportID = taskReportID;
reportAction.reportAction.parentReportID = parentReportID;
reportAction.reportAction.childType = CONST.REPORT.TYPE.TASK;
reportAction.reportAction.taskTitle = taskTitle;
reportAction.reportAction.taskAssignee = taskAssignee;
reportAction.reportAction.childReportName = taskTitle;
reportAction.reportAction.childManagerEmail = taskAssignee;
reportAction.reportAction.childStatusNum = CONST.REPORT.STATUS.OPEN;
reportAction.reportAction.childStateNum = CONST.REPORT.STATE_NUM.OPEN;

Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function editTaskAndNavigate(report, ownerEmail, title, description, assignee) {
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`,
value: {reportName: report.reportName, description: report.description, assignee: report.assignee},
value: {reportName: report.reportName, description: report.description, assignee: report.managerEmail},
},
];

Expand Down Expand Up @@ -380,8 +380,8 @@ function editTaskAndNavigate(report, ownerEmail, title, description, assignee) {
{
taskReportID: report.reportID,
title: reportName,
description: description.trim(),
assignee: assignee || report.assignee,
description: (description || report.description).trim(),
assignee: assignee || report.managerEmail,
editedTaskReportActionID: editTaskReportAction.reportActionID,
assigneeChatReportActionID: optimisticAssigneeAddComment ? optimisticAssigneeAddComment.reportAction.reportActionID : 0,
},
Expand Down

0 comments on commit f8a0a34

Please sign in to comment.