From 34ee0f9635ce9242406612f8b31c562e3f175cb9 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 28 Sep 2023 15:32:53 +0700 Subject: [PATCH 1/4] Add pending fields when edit task assignee --- src/libs/actions/Task.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 91267b9b1053..bbf376d5eb3d 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -519,10 +519,19 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi reportName, managerID: assigneeAccountID || report.managerID, managerEmail: assigneeEmail || report.managerEmail, + pendingFields: { + ...(assigneeAccountID && {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}), + }, }, }, ]; - const successData = []; + const successData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, + value: {pendingFields: {managerID: null}} + } + ]; const failureData = [ { onyxMethod: Onyx.METHOD.MERGE, From 8d7066a1122989425be5f85f1cf4f55fe7feff0e Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 28 Sep 2023 16:38:49 +0700 Subject: [PATCH 2/4] fix lint --- src/libs/actions/Task.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index bbf376d5eb3d..20836b8cdbd2 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -521,7 +521,7 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi managerEmail: assigneeEmail || report.managerEmail, pendingFields: { ...(assigneeAccountID && {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}), - }, + }, }, }, ]; @@ -529,8 +529,8 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, - value: {pendingFields: {managerID: null}} - } + value: {pendingFields: {managerID: null}}, + }, ]; const failureData = [ { From adefd9bef825a3f016e571d1919293ea667df46f Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 5 Oct 2023 17:16:13 +0700 Subject: [PATCH 3/4] fix pending field when edit task --- 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 20836b8cdbd2..1304838a5896 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -520,7 +520,7 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi managerID: assigneeAccountID || report.managerID, managerEmail: assigneeEmail || report.managerEmail, pendingFields: { - ...(assigneeAccountID && {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}), + ...(assigneeAccountID && {managerID: null}), }, }, }, From 958ed581ee06d007184954b157b7719b0430685e Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 5 Oct 2023 17:25:55 +0700 Subject: [PATCH 4/4] fix pending field when edit task assignee --- src/libs/actions/Task.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 1304838a5896..02cd4bb586e7 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -520,7 +520,7 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi managerID: assigneeAccountID || report.managerID, managerEmail: assigneeEmail || report.managerEmail, pendingFields: { - ...(assigneeAccountID && {managerID: null}), + ...(assigneeAccountID && {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}), }, }, }, @@ -529,7 +529,7 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, - value: {pendingFields: {managerID: null}}, + value: {pendingFields: {...(assigneeAccountID && {managerID: null})}}, }, ]; const failureData = [