Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show assigned user as mention in the task preview #19990

Merged
merged 9 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dukenv0307, @sobitneupane There is a potential regression from this line. @dukenv0307 It appears that when you merged main , you reverted some changes made in #19749, and that caused a regression where the description cannot be set to empty. More details https://expensify.slack.com/archives/C049HHMV9SM/p1686034899013369

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fedirjh my mistake, but #19749 may be a regression. Help to check my comment in this PR. If it is true, help me to fix my mistake in here with fixing the regression. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dukenv0307 I have posted a simple fix for this regression , check my comment here #19749 (comment)

assignee: assignee || report.managerEmail,
editedTaskReportActionID: editTaskReportAction.reportActionID,
assigneeChatReportActionID: optimisticAssigneeAddComment ? optimisticAssigneeAddComment.reportAction.reportActionID : 0,
},
Expand Down