From a5c664c9a3beb8ec86d78b68a17adc8763ed67de Mon Sep 17 00:00:00 2001 From: sjaanus Date: Tue, 30 Jan 2024 10:20:51 +0200 Subject: [PATCH] Rever conflict --- .../ChangeRequestOverview.tsx | 68 +++++-------------- .../ChangeRequestSidebar.tsx | 2 +- .../useChangeRequestApi.ts | 2 - 3 files changed, 18 insertions(+), 54 deletions(-) diff --git a/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx b/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx index 362001816702..0746576f7ab1 100644 --- a/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx +++ b/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx @@ -113,10 +113,6 @@ export const ChangeRequestOverview: FC = () => { changeRequest.environment, ); - const conflictCount = changeRequest.features.filter( - (feature) => feature.conflict, - ).length; - const getCurrentState = (): PlausibleChangeRequestState => { switch (changeRequest.state) { case 'Scheduled': @@ -128,15 +124,9 @@ export const ChangeRequestOverview: FC = () => { const onApplyChanges = async () => { try { - await changeState( - projectId, - Number(id), - getCurrentState(), - conflictCount, - { - state: 'Applied', - }, - ); + await changeState(projectId, Number(id), getCurrentState(), { + state: 'Applied', + }); setShowApplyScheduledDialog(false); refetchChangeRequest(); refetchChangeRequestOpen(); @@ -152,16 +142,10 @@ export const ChangeRequestOverview: FC = () => { const onScheduleChangeRequest = async (scheduledDate: Date) => { try { - await changeState( - projectId, - Number(id), - getCurrentState(), - conflictCount, - { - state: 'Scheduled', - scheduledAt: scheduledDate.toISOString(), - }, - ); + await changeState(projectId, Number(id), getCurrentState(), { + state: 'Scheduled', + scheduledAt: scheduledDate.toISOString(), + }); setShowScheduleChangeDialog(false); refetchChangeRequest(); refetchChangeRequestOpen(); @@ -192,15 +176,9 @@ export const ChangeRequestOverview: FC = () => { const onCancelChanges = async () => { try { - await changeState( - projectId, - Number(id), - getCurrentState(), - conflictCount, - { - state: 'Cancelled', - }, - ); + await changeState(projectId, Number(id), getCurrentState(), { + state: 'Cancelled', + }); setShowCancelDialog(false); refetchChangeRequest(); refetchChangeRequestOpen(); @@ -216,16 +194,10 @@ export const ChangeRequestOverview: FC = () => { const onReject = async (comment?: string) => { try { - await changeState( - projectId, - Number(id), - getCurrentState(), - conflictCount, - { - state: 'Rejected', - comment, - }, - ); + await changeState(projectId, Number(id), getCurrentState(), { + state: 'Rejected', + comment, + }); setShowRejectDialog(false); setToastData({ type: 'success', @@ -241,15 +213,9 @@ export const ChangeRequestOverview: FC = () => { const onApprove = async () => { try { - await changeState( - projectId, - Number(id), - getCurrentState(), - conflictCount, - { - state: 'Approved', - }, - ); + await changeState(projectId, Number(id), getCurrentState(), { + state: 'Approved', + }); refetchChangeRequest(); refetchChangeRequestOpen(); setToastData({ diff --git a/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx b/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx index 170a1174b42b..3177cb7b079a 100644 --- a/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx +++ b/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx @@ -81,7 +81,7 @@ export const ChangeRequestSidebar: VFC = ({ const onReview = async (draftId: number, comment?: string) => { try { - await changeState(project, draftId, 'Draft', 0, { + await changeState(project, draftId, 'Draft', { state: 'In review', comment, }); diff --git a/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts b/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts index b68d9125b8c2..d131d321f9d4 100644 --- a/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts +++ b/frontend/src/hooks/api/actions/useChangeRequestApi/useChangeRequestApi.ts @@ -59,7 +59,6 @@ export const useChangeRequestApi = () => { project: string, changeRequestId: number, previousState: PlausibleChangeRequestState, - conflictCount: number, payload: { state: | 'Approved' @@ -77,7 +76,6 @@ export const useChangeRequestApi = () => { eventType: payload.state, previousState, id: getUniqueChangeRequestId(uiConfig, changeRequestId), - conflictCount, }, });