Skip to content

Commit

Permalink
Merge pull request #34527 from mkhutornyi/fix-34518
Browse files Browse the repository at this point in the history
fix unable to add assignee when creating a task
  • Loading branch information
roryabraham authored Jan 15, 2024
2 parents 2c41828 + 2b11531 commit 34ec480
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/pages/tasks/TaskAssigneeSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,29 +184,29 @@ function TaskAssigneeSelectorModal(props) {
return sectionsList;
}, [filteredCurrentUserOption, filteredPersonalDetails, filteredRecentReports, filteredUserToInvite, props]);

const selectReport = (option) => {
if (!option) {
return;
}

// Check to see if we're creating a new task
// If there's no route params, we're creating a new task
if (!props.route.params && option.accountID) {
Task.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
return Navigation.goBack(ROUTES.NEW_TASK);
}

// Check to see if we're editing a task and if so, update the assignee
if (report) {
if (option.accountID !== report.managerID) {
const assigneeChatReport = Task.setAssigneeValue(option.login, option.accountID, props.route.params.reportID, OptionsListUtils.isCurrentUser(option));
const selectReport = useCallback(
(option) => {
if (!option) {
return;
}

// Pass through the selected assignee
Task.editTaskAssignee(report, props.session.accountID, option.login, option.accountID, assigneeChatReport);
// Check to see if we're editing a task and if so, update the assignee
if (report) {
if (option.accountID !== report.managerID) {
const assigneeChatReport = Task.setAssigneeValue(option.login, option.accountID, report.reportID, OptionsListUtils.isCurrentUser(option));

// Pass through the selected assignee
Task.editTaskAssignee(report, props.session.accountID, option.login, option.accountID, assigneeChatReport);
}
Navigation.dismissModal(report.reportID);
// If there's no report, we're creating a new task
} else if (option.accountID) {
Task.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
Navigation.goBack(ROUTES.NEW_TASK);
}
return Navigation.dismissModal(report.reportID);
}
};
},
[props.session.accountID, props.task.shareDestination, report],
);

const isOpen = ReportUtils.isOpenTaskReport(report);
const canModifyTask = Task.canModifyTask(report, props.currentUserPersonalDetails.accountID, lodashGet(props.rootParentReportPolicy, 'role', ''));
Expand Down

0 comments on commit 34ec480

Please sign in to comment.