From 6d414cd78c5656fbc4af27273391b9dfa1b2bc0d Mon Sep 17 00:00:00 2001 From: c3024 Date: Fri, 28 Jul 2023 07:22:12 +0530 Subject: [PATCH 1/4] use getIconsForParticipants for assignee in task --- src/libs/actions/Task.js | 5 ++--- src/pages/tasks/NewTaskPage.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index aa383e94ecdd..079f2d6e40d1 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -571,7 +571,7 @@ function clearOutTaskInfoAndNavigate(reportID) { * @param {Object} details * @returns {Object} */ -function getAssignee(details) { +function getAssignee(details, personalDetails) { if (!details) { return { icons: [], @@ -579,9 +579,8 @@ function getAssignee(details) { subtitle: '', }; } - const source = UserUtils.getAvatar(lodashGet(details, 'avatar', ''), lodashGet(details, 'accountID', -1)); return { - icons: [{source, type: 'avatar', name: details.login}], + icons: ReportUtils.getIconsForParticipants([details.accountID], personalDetails), displayName: details.displayName, subtitle: details.login, }; diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 3e9cbb4dfdeb..d50c65ce119b 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -82,7 +82,7 @@ function NewTaskPage(props) { if (!assigneeDetails) { return setErrorMessage(props.translate('task.assigneeError')); } - const displayDetails = Task.getAssignee(assigneeDetails); + const displayDetails = Task.getAssignee(assigneeDetails, props.personalDetails); setAssignee(displayDetails); } From b1bd27e774a2b2924043299e2cd1e146a46836ac Mon Sep 17 00:00:00 2001 From: c3024 Date: Fri, 28 Jul 2023 08:11:20 +0530 Subject: [PATCH 2/4] add JSDoc personalDetails to getAssignee --- src/libs/actions/Task.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 079f2d6e40d1..af301f3ecbb9 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -569,6 +569,7 @@ function clearOutTaskInfoAndNavigate(reportID) { * Get the assignee data * * @param {Object} details + * @param {Object} personalDetails * @returns {Object} */ function getAssignee(details, personalDetails) { From fc1929ee4c8c03a5c3a0bda7de6450c38198430f Mon Sep 17 00:00:00 2001 From: c3024 Date: Sat, 29 Jul 2023 07:26:43 +0530 Subject: [PATCH 3/4] use assigneeAccountID at details for getAssignee --- src/libs/actions/Task.js | 5 +++-- src/pages/tasks/NewTaskPage.js | 7 +------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index af301f3ecbb9..f703408ed151 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -568,11 +568,12 @@ function clearOutTaskInfoAndNavigate(reportID) { /** * Get the assignee data * - * @param {Object} details + * @param {string} assigneeAccountID * @param {Object} personalDetails * @returns {Object} */ -function getAssignee(details, personalDetails) { +function getAssignee(assigneeAccountID, personalDetails) { + const details = personalDetails[assigneeAccountID]; if (!details) { return { icons: [], diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index d50c65ce119b..4b1aa0c0101b 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -17,7 +17,6 @@ import MenuItemWithTopDescription from '../../components/MenuItemWithTopDescript import MenuItem from '../../components/MenuItem'; import reportPropTypes from '../reportPropTypes'; import * as Task from '../../libs/actions/Task'; -import * as OptionsListUtils from '../../libs/OptionsListUtils'; import * as ReportUtils from '../../libs/ReportUtils'; import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButton'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; @@ -78,11 +77,7 @@ function NewTaskPage(props) { // If we have an assignee, we want to set the assignee data // If there's an issue with the assignee chosen, we want to notify the user if (props.task.assignee) { - const assigneeDetails = lodashGet(OptionsListUtils.getPersonalDetailsForAccountIDs([props.task.assigneeAccountID], props.personalDetails), props.task.assigneeAccountID); - if (!assigneeDetails) { - return setErrorMessage(props.translate('task.assigneeError')); - } - const displayDetails = Task.getAssignee(assigneeDetails, props.personalDetails); + const displayDetails = Task.getAssignee(props.task.assigneeAccountID, props.personalDetails); setAssignee(displayDetails); } From bbdece458cebc5a3fccefcfa292afd3129a60999 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 1 Aug 2023 03:03:38 +0530 Subject: [PATCH 4/4] change param to Number in doc for getAssignee --- src/libs/actions/Task.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index f703408ed151..3c6ddefbc32d 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -568,7 +568,7 @@ function clearOutTaskInfoAndNavigate(reportID) { /** * Get the assignee data * - * @param {string} assigneeAccountID + * @param {Number} assigneeAccountID * @param {Object} personalDetails * @returns {Object} */