Skip to content

Commit

Permalink
Merge pull request #23773 from c3024/23632-show-displayName-in-assign…
Browse files Browse the repository at this point in the history
…ee-in-Task-page
  • Loading branch information
thienlnam authored Aug 1, 2023
2 parents b8733f4 + bbdece4 commit a750097
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,20 +568,21 @@ function clearOutTaskInfoAndNavigate(reportID) {
/**
* Get the assignee data
*
* @param {Object} details
* @param {Number} assigneeAccountID
* @param {Object} personalDetails
* @returns {Object}
*/
function getAssignee(details) {
function getAssignee(assigneeAccountID, personalDetails) {
const details = personalDetails[assigneeAccountID];
if (!details) {
return {
icons: [],
displayName: '',
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,
};
Expand Down
7 changes: 1 addition & 6 deletions src/pages/tasks/NewTaskPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
const displayDetails = Task.getAssignee(props.task.assigneeAccountID, props.personalDetails);
setAssignee(displayDetails);
}

Expand Down

0 comments on commit a750097

Please sign in to comment.