diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 1e484b172d3f..20ccd49620b1 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -94,9 +94,9 @@ function TaskPreview(props) { disabled={ReportUtils.isCanceledTaskReport(props.taskReport)} onPress={Session.checkIfActionIsAllowed(() => { if (isTaskCompleted) { - Task.reopenTask(props.taskReport, taskTitle); + Task.reopenTask(props.taskReport); } else { - Task.completeTask(props.taskReport, taskTitle); + Task.completeTask(props.taskReport); } })} accessibilityLabel={props.translate('task.task')} diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index 39807ab037d5..c52427ae1e8d 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -91,9 +91,9 @@ function TaskView(props) { { if (isCompleted) { - Task.reopenTask(props.report, taskTitle); + Task.reopenTask(props.report); } else { - Task.completeTask(props.report, taskTitle); + Task.completeTask(props.report); } })} isChecked={isCompleted} diff --git a/src/components/TaskHeaderActionButton.js b/src/components/TaskHeaderActionButton.js index aa7694095f5b..b22b5c92bf70 100644 --- a/src/components/TaskHeaderActionButton.js +++ b/src/components/TaskHeaderActionButton.js @@ -36,10 +36,8 @@ function TaskHeaderActionButton(props) { success isDisabled={ReportUtils.isCanceledTaskReport(props.report) || !Task.canModifyTask(props.report, props.session.accountID)} medium - text={props.translate(ReportUtils.isCompletedTaskReport(props.report) ? 'task.markAsIncomplete' : 'task.markAsDone')} - onPress={() => - ReportUtils.isCompletedTaskReport(props.report) ? Task.reopenTask(props.report, props.report.reportName) : Task.completeTask(props.report, props.report.reportName) - } + text={props.translate(ReportUtils.isCompletedTaskReport(props.report) ? 'task.markAsIncomplete' : 'task.markAsComplete')} + onPress={() => (ReportUtils.isCompletedTaskReport(props.report) ? Task.reopenTask(props.report) : Task.completeTask(props.report))} style={[styles.flex1]} /> diff --git a/src/languages/en.ts b/src/languages/en.ts index 43d93e093d69..dfad8883e270 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1534,12 +1534,12 @@ export default { assignee: 'Assignee', completed: 'Completed', messages: { - completed: 'completed task', + completed: 'marked as complete', canceled: 'deleted task', - reopened: 'reopened task', + reopened: 'marked as incomplete', error: 'You do not have the permission to do the requested action.', }, - markAsDone: 'Mark as done', + markAsComplete: 'Mark as complete', markAsIncomplete: 'Mark as incomplete', assigneeError: 'There was an error assigning this task, please try another assignee.', }, diff --git a/src/languages/es.ts b/src/languages/es.ts index 582134c32896..6ffbda2648c6 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1556,12 +1556,12 @@ export default { assignee: 'Usuario asignado', completed: 'Completada', messages: { - completed: 'tarea completada', + completed: 'marcada como completa', canceled: 'tarea eliminado', - reopened: 'tarea reabrir', + reopened: 'marcada como incompleta', error: 'No tiene permiso para realizar la acción solicitada.', }, - markAsDone: 'Marcar como completada', + markAsComplete: 'Marcar como completada', markAsIncomplete: 'Marcar como incompleta', assigneeError: 'Hubo un error al asignar esta tarea, inténtalo con otro usuario.', }, diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 57f6c0da72d0..42e7e40fe62b 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2551,7 +2551,7 @@ function buildOptimisticCreatedReportAction(emailCreatingAction) { { type: CONST.REPORT.MESSAGE.TYPE.TEXT, style: 'strong', - text: emailCreatingAction === currentUserEmail ? 'You' : emailCreatingAction, + text: emailCreatingAction, }, { type: CONST.REPORT.MESSAGE.TYPE.TEXT, @@ -2590,7 +2590,7 @@ function buildOptimisticEditedTaskReportAction(emailEditingTask) { { type: CONST.REPORT.MESSAGE.TYPE.TEXT, style: 'strong', - text: emailEditingTask === currentUserEmail ? 'You' : emailEditingTask, + text: emailEditingTask, }, { type: CONST.REPORT.MESSAGE.TYPE.TEXT, @@ -2631,7 +2631,7 @@ function buildOptimisticClosedReportAction(emailClosingReport, policyName, reaso { type: CONST.REPORT.MESSAGE.TYPE.TEXT, style: 'strong', - text: emailClosingReport === currentUserEmail ? 'You' : emailClosingReport, + text: emailClosingReport, }, { type: CONST.REPORT.MESSAGE.TYPE.TEXT, @@ -3584,8 +3584,8 @@ function getTaskAssigneeChatOnyxData(accountID, assigneeEmail, assigneeAccountID // If you're choosing to share the task in the same DM as the assignee then we don't need to create another reportAction indicating that you've been assigned if (assigneeChatReportID !== parentReportID) { - optimisticAssigneeAddComment = buildOptimisticTaskCommentReportAction(taskReportID, title, assigneeEmail, assigneeAccountID, `Assigned a task to you: ${title}`, parentReportID); - + const displayname = lodashGet(allPersonalDetails, [assigneeAccountID, 'displayName']) || lodashGet(allPersonalDetails, [assigneeAccountID, 'login'], ''); + optimisticAssigneeAddComment = buildOptimisticTaskCommentReportAction(taskReportID, title, assigneeEmail, assigneeAccountID, `assigned to ${displayname}`, parentReportID); const lastAssigneeCommentText = formatReportLastMessageText(optimisticAssigneeAddComment.reportAction.message[0].text); const optimisticAssigneeReport = { lastVisibleActionCreated: currentTime, diff --git a/src/libs/SidebarUtils.js b/src/libs/SidebarUtils.js index a280947a97b5..7a32db660021 100644 --- a/src/libs/SidebarUtils.js +++ b/src/libs/SidebarUtils.js @@ -351,9 +351,9 @@ function getOptionData(report, reportActions, personalDetails, preferredLocale, const newName = lodashGet(lastAction, 'originalMessage.newName', ''); result.alternateText = Localize.translate(preferredLocale, 'newRoomPage.roomRenamedTo', {newName}); } else if (lodashGet(lastAction, 'actionName', '') === CONST.REPORT.ACTIONS.TYPE.TASKREOPENED) { - result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.reopened')}: ${report.reportName}`; + result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.reopened')}`; } else if (lodashGet(lastAction, 'actionName', '') === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED) { - result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.completed')}: ${report.reportName}`; + result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.completed')}`; } else if (lodashGet(lastAction, 'actionName', '') !== CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && lastActorDisplayName && lastMessageTextFromReport) { result.alternateText = `${lastActorDisplayName}: ${lastMessageText}`; } else { diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 963bfebb7eb2..91267b9b1053 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -70,7 +70,7 @@ function createTaskAndNavigate(parentReportID, title, description, assigneeEmail // Parent ReportAction indicating that a task has been created const optimisticTaskCreatedAction = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmail); - const optimisticAddCommentReport = ReportUtils.buildOptimisticTaskCommentReportAction(taskReportID, title, assigneeEmail, assigneeAccountID, `Created a task: ${title}`, parentReportID); + const optimisticAddCommentReport = ReportUtils.buildOptimisticTaskCommentReportAction(taskReportID, title, assigneeEmail, assigneeAccountID, `task for ${title}`, parentReportID); optimisticTaskReport.parentReportActionID = optimisticAddCommentReport.reportAction.reportActionID; const currentTime = DateUtils.getDBTime(); @@ -219,11 +219,10 @@ function createTaskAndNavigate(parentReportID, title, description, assigneeEmail /** * Complete a task * @param {Object} taskReport task report - * @param {String} taskTitle Title of the task */ -function completeTask(taskReport, taskTitle) { +function completeTask(taskReport) { const taskReportID = taskReport.reportID; - const message = `completed task: ${taskTitle}`; + const message = `marked as complete`; const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED, message); const optimisticData = [ @@ -303,11 +302,10 @@ function completeTask(taskReport, taskTitle) { /** * Reopen a closed task * @param {Object} taskReport task report - * @param {String} taskTitle Title of the task */ -function reopenTask(taskReport, taskTitle) { +function reopenTask(taskReport) { const taskReportID = taskReport.reportID; - const message = `reopened task: ${taskTitle}`; + const message = `marked as incomplete`; const reopenedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKREOPENED, message); const optimisticData = [ @@ -924,7 +922,7 @@ function clearEditTaskErrors(reportID) { function getTaskReportActionMessage(actionName, reportID, isCreateTaskAction) { const report = ReportUtils.getReport(reportID); if (isCreateTaskAction) { - return `Created a task: ${report.reportName}`; + return `task for ${report.reportName}`; } let taskStatusText = ''; switch (actionName) { @@ -941,7 +939,7 @@ function getTaskReportActionMessage(actionName, reportID, isCreateTaskAction) { taskStatusText = Localize.translateLocal('task.task'); } - return `${taskStatusText} ${report.reportName}`; + return `${taskStatusText}`; } export { diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index b7d9a923d0bf..ba4787f9b4b4 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -93,8 +93,8 @@ function HeaderView(props) { if (ReportUtils.isOpenTaskReport(props.report) && canModifyTask) { threeDotMenuItems.push({ icon: Expensicons.Checkmark, - text: props.translate('task.markAsDone'), - onSelected: () => Task.completeTask(props.report, title), + text: props.translate('task.markAsComplete'), + onSelected: () => Task.completeTask(props.report), }); } @@ -103,7 +103,7 @@ function HeaderView(props) { threeDotMenuItems.push({ icon: Expensicons.Checkmark, text: props.translate('task.markAsIncomplete'), - onSelected: () => Task.reopenTask(props.report, title), + onSelected: () => Task.reopenTask(props.report), }); }