Skip to content

Commit

Permalink
Merge pull request #30671 from Tony-MK/fix/29228
Browse files Browse the repository at this point in the history
Fix/29228: Task needs revisit to update members
  • Loading branch information
luacmartins authored Nov 1, 2023
2 parents 83a4cce + 60988f8 commit f9d11c5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi

let assigneeChatReportOnyxData;
const assigneeChatReportID = assigneeChatReport ? assigneeChatReport.reportID : 0;
const optimisticReport = {
reportName,
managerID: assigneeAccountID || report.managerID,
managerEmail: assigneeEmail || report.managerEmail,
pendingFields: {
...(assigneeAccountID && {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}),
},
};

const optimisticData = [
{
Expand All @@ -446,14 +454,7 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`,
value: {
reportName,
managerID: assigneeAccountID || report.managerID,
managerEmail: assigneeEmail || report.managerEmail,
pendingFields: {
...(assigneeAccountID && {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}),
},
},
value: optimisticReport,
},
];
const successData = [
Expand All @@ -479,6 +480,11 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi
// If we make a change to the assignee, we want to add a comment to the assignee's chat
// Check if the assignee actually changed
if (assigneeAccountID && assigneeAccountID !== report.managerID && assigneeAccountID !== ownerAccountID && assigneeChatReport) {
const participants = lodashGet(report, 'participantAccountIDs', []);
if (!participants.includes(assigneeAccountID)) {
optimisticReport.participantAccountIDs = [...participants, assigneeAccountID];
}

assigneeChatReportOnyxData = ReportUtils.getTaskAssigneeChatOnyxData(
currentUserAccountID,
assigneeEmail,
Expand Down

0 comments on commit f9d11c5

Please sign in to comment.