Skip to content

Commit

Permalink
fix copy addcomment text
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanDylann committed Sep 15, 2023
1 parent a9a3963 commit d8d98cd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/TaskAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function TaskAction(props) {
return (
<>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.chatItemMessage, styles.colorMuted]}>{Task.getTaskReportActionMessage(props.actionName, props.taskReportID)}</Text>
<Text style={[styles.chatItemMessage, styles.colorMuted]}>{Task.getTaskReportActionMessage(props.actionName, props.taskReportID, false)}</Text>
</View>
</>
);
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,7 @@ export default {
reopened: 'reopened task',
error: 'You do not have the permission to do the requested action.',
},
createdTask: ({title}: {title: string}) => `Created a task: ${title}`,
markAsDone: 'Mark as done',
markAsIncomplete: 'Mark as incomplete',
assigneeError: 'There was an error assigning this task, please try another assignee.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,7 @@ export default {
reopened: 'tarea reabrir',
error: 'No tiene permiso para realizar la acción solicitada.',
},
createdTask: ({title}: {title: string}) => `Creó una tarea: ${title}`,
markAsDone: 'Marcar como completada',
markAsIncomplete: 'Marcar como incompleta',
assigneeError: 'Hubo un error al asignar esta tarea, inténtalo con otro usuario.',
Expand Down
9 changes: 7 additions & 2 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,9 +898,14 @@ function clearEditTaskErrors(reportID) {
/**
* @param {string} actionName
* @param {string} reportID
* @param {boolean} isCreateTaskAction
* @returns {string}
*/
function getTaskReportActionMessage(actionName, reportID) {
function getTaskReportActionMessage(actionName, reportID, isCreateTaskAction) {
const report = ReportUtils.getReport(reportID);
if (isCreateTaskAction) {
return Localize.translateLocal('task.createdTask', {title: report.reportName});
}
let taskStatusText = '';
switch (actionName) {
case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED:
Expand All @@ -916,7 +921,7 @@ function getTaskReportActionMessage(actionName, reportID) {
taskStatusText = Localize.translateLocal('task.task');
}

return `${taskStatusText} ${ReportUtils.getReport(reportID).reportName}`;
return `${taskStatusText} ${report.reportName}`;
}

export {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ export default [
// the `text` and `icon`
onPress: (closePopover, {reportAction, selection}) => {
const isTaskAction = ReportActionsUtils.isTaskAction(reportAction);
const isCreateTaskAction = ReportActionsUtils.isCreatedTaskReportAction(reportAction);
const isReportPreviewAction = ReportActionsUtils.isReportPreviewAction(reportAction);
const message = _.last(lodashGet(reportAction, 'message', [{}]));
const reportID = lodashGet(reportAction, 'originalMessage.taskReportID', '').toString();
const messageHtml = isTaskAction ? Task.getTaskReportActionMessage(reportAction.actionName, reportID) : lodashGet(message, 'html', '');
const messageHtml = isTaskAction || isCreateTaskAction ? Task.getTaskReportActionMessage(reportAction.actionName, reportID, isCreateTaskAction) : lodashGet(message, 'html', '');

const isAttachment = _.has(reportAction, 'isAttachment') ? reportAction.isAttachment : ReportUtils.isReportMessageAttachment(message);
if (!isAttachment) {
Expand Down

0 comments on commit d8d98cd

Please sign in to comment.