From 6b4bb76093b10cd27c68464119b86e85571e8962 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Mon, 23 Dec 2024 17:05:00 +0100 Subject: [PATCH] Revert "WIP" This reverts commit 2cc6fe823644922c5ebe19c425eda052b11d78b4. --- .../Coverages/CoverageEditor/CoverageForm.tsx | 1 - client/components/Planning/PlanningEditor/index.tsx | 1 - client/components/fields/editor/Coverages.tsx | 1 - client/components/fields/editor/Genre.tsx | 5 ----- .../authoring-storage-http.ts | 13 ++----------- client/utils/planning.tsx | 2 +- 6 files changed, 3 insertions(+), 20 deletions(-) diff --git a/client/components/Coverages/CoverageEditor/CoverageForm.tsx b/client/components/Coverages/CoverageEditor/CoverageForm.tsx index 22c5b8404..185a778a7 100644 --- a/client/components/Coverages/CoverageEditor/CoverageForm.tsx +++ b/client/components/Coverages/CoverageEditor/CoverageForm.tsx @@ -129,7 +129,6 @@ export class CoverageFormComponent extends React.Component { } onChange(field: string, value: any) { - debugger; this.props.onChange( `${this.props.field}.${field}`, value diff --git a/client/components/Planning/PlanningEditor/index.tsx b/client/components/Planning/PlanningEditor/index.tsx index c4b27a6c6..8e160047b 100644 --- a/client/components/Planning/PlanningEditor/index.tsx +++ b/client/components/Planning/PlanningEditor/index.tsx @@ -250,7 +250,6 @@ class PlanningEditorComponent extends React.Component { onCoverageChange(field: string, value: any, planningFormEdited: boolean = true) { let valueToUpdate = value; - // if (field.match(/^coverages\[/)) { const {newsCoverageStatus} = this.props; diff --git a/client/components/fields/editor/Coverages.tsx b/client/components/fields/editor/Coverages.tsx index a5c70c8ef..e36aa92d8 100644 --- a/client/components/fields/editor/Coverages.tsx +++ b/client/components/fields/editor/Coverages.tsx @@ -12,7 +12,6 @@ export class EditorFieldCoverages extends React.PureComponent { render() { const {gettext} = superdeskApi.localization; - console.log('genre props', this.props); - return ( - <> { options={this.props.genres} labelField="name" /> -
zap: {this.props.field ?? 'genre'}
- ); } } diff --git a/client/components/planning-editor-standalone/authoring-storage-http.ts b/client/components/planning-editor-standalone/authoring-storage-http.ts index cfc50600d..96fc1ea1a 100644 --- a/client/components/planning-editor-standalone/authoring-storage-http.ts +++ b/client/components/planning-editor-standalone/authoring-storage-http.ts @@ -5,7 +5,6 @@ import {superdeskApi} from '../../superdeskApi'; import {getProfile} from './profile'; import {omitFields} from './utils'; import {AutoSavePlanningItem, NoAutoSavePlanningItem} from './authoring-autosave'; -import {planningUtils} from '../../utils'; const getAutosavedPlanningItem = (id: IPlanningItem['_id']): Promise => { return new Promise((resolve) => { @@ -31,10 +30,7 @@ export const authoringStoragePlanningItemHttp: IAuthoringStorage path: `/planning/${id}`, }) ]).then(([autosaved, saved]) => { - return { - autosaved: autosaved == null ? null : planningUtils.modifyForClient(autosaved), - saved: planningUtils.modifyForClient(saved), - }; + return {autosaved, saved}; }); }, @@ -51,12 +47,7 @@ export const authoringStoragePlanningItemHttp: IAuthoringStorage return httpRequestJsonLocal({ method: 'PATCH', path: `/planning/${original._id}`, - payload: omitFields( - generatePatch( - planningUtils.modifyForServer(original), - planningUtils.modifyForServer(current), - ), - ), + payload: omitFields(generatePatch(original, current)), headers: { 'If-Match': original._etag, }, diff --git a/client/utils/planning.tsx b/client/utils/planning.tsx index 6f5266bb1..dd3b3528a 100644 --- a/client/utils/planning.tsx +++ b/client/utils/planning.tsx @@ -890,7 +890,7 @@ function getPlanningActionsForUiFrameworkMenu(data: IGetPlanningActionArgs): Arr return toUIFrameworkInterface(planningUtils.getPlanningActions(data)); } -export function modifyForClient>(plan: T): T { +export function modifyForClient(plan: Partial): Partial { sanitizeItemFields(plan); // The `_status` field is available when the item comes from a POST/PATCH request