From 7f17855061b6244887984461a072da98f1a8554c Mon Sep 17 00:00:00 2001 From: Cedric Karungu Date: Sun, 3 Nov 2024 05:49:27 +0200 Subject: [PATCH 1/3] fix: update Team Member Role --- apps/web/lib/settings/member-table.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/web/lib/settings/member-table.tsx b/apps/web/lib/settings/member-table.tsx index 83caa5430..7768b1098 100644 --- a/apps/web/lib/settings/member-table.tsx +++ b/apps/web/lib/settings/member-table.tsx @@ -59,18 +59,19 @@ export const MemberTable = ({ members }: { members: OT_Member[] }) => { if (isPromotingToManager) { // Add new manager - const updatedMemberIds = [...new Set([ - ...(activeTeamRef.current?.members || []).map((member: OT_Member) => member.employee.id), - employeeId - ])]; + const updatedManagerIds = [...new Set([...currentManagers, employeeId])]; return updateOrganizationTeam(activeTeamRef.current, { ...activeTeamRef.current, - memberIds: updatedMemberIds + managerIds: updatedManagerIds }); } else { // Remove manager - const updatedMemberIds = [...new Set([...currentManagers, employeeId])]; + const updatedMemberIds = [...new Set([ + ...(activeTeamRef.current?.members || []).map((member: OT_Member) => member.employee.id), + employeeId + ])]; + const updatedManagerIds = currentManagers.filter(id => id !== employeeId); return updateOrganizationTeam(activeTeamRef.current, { From 265e67118a4795aeb4ccdce8e4a7d73d4664c9ca Mon Sep 17 00:00:00 2001 From: Cedric Karungu | Lord VB Date: Mon, 11 Nov 2024 07:36:32 +0200 Subject: [PATCH 2/3] (apps/web)[fix]: Remove Team Manager Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- apps/web/lib/settings/member-table.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/lib/settings/member-table.tsx b/apps/web/lib/settings/member-table.tsx index 7768b1098..a517d117c 100644 --- a/apps/web/lib/settings/member-table.tsx +++ b/apps/web/lib/settings/member-table.tsx @@ -67,11 +67,12 @@ export const MemberTable = ({ members }: { members: OT_Member[] }) => { }); } else { // Remove manager - const updatedMemberIds = [...new Set([ - ...(activeTeamRef.current?.members || []).map((member: OT_Member) => member.employee.id), - employeeId - ])]; + const updatedManagerIds = currentManagers.filter(id => id !== employeeId); + return updateOrganizationTeam(activeTeamRef.current, { + ...activeTeamRef.current, + managerIds: updatedManagerIds, + }); const updatedManagerIds = currentManagers.filter(id => id !== employeeId); return updateOrganizationTeam(activeTeamRef.current, { From 0e762d308e6fca1202e618551eba8879ed648ec3 Mon Sep 17 00:00:00 2001 From: Cedric Karungu Date: Mon, 11 Nov 2024 07:41:51 +0200 Subject: [PATCH 3/3] fix: error --- apps/web/lib/settings/member-table.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/apps/web/lib/settings/member-table.tsx b/apps/web/lib/settings/member-table.tsx index a517d117c..497148d72 100644 --- a/apps/web/lib/settings/member-table.tsx +++ b/apps/web/lib/settings/member-table.tsx @@ -73,13 +73,6 @@ export const MemberTable = ({ members }: { members: OT_Member[] }) => { ...activeTeamRef.current, managerIds: updatedManagerIds, }); - const updatedManagerIds = currentManagers.filter(id => id !== employeeId); - - return updateOrganizationTeam(activeTeamRef.current, { - ...activeTeamRef.current, - memberIds: updatedMemberIds, - managerIds: updatedManagerIds, - }); } }, [updateOrganizationTeam, activeTeamRef]);