From 52437090b8af77934490fe664d3dc2731953b754 Mon Sep 17 00:00:00 2001
From: Konstantin Markov <maga.ot.oz@protonmail.com>
Date: Mon, 20 Feb 2023 15:37:19 +0200
Subject: [PATCH] Changes after review

---
 scripts/apps/authoring-react/data-layer.ts       | 3 +++
 scripts/apps/authoring/metadata/PlacesService.ts | 2 +-
 scripts/core/superdesk-api.d.ts                  | 1 -
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/apps/authoring-react/data-layer.ts b/scripts/apps/authoring-react/data-layer.ts
index 4f52169b2b..410cc9984f 100644
--- a/scripts/apps/authoring-react/data-layer.ts
+++ b/scripts/apps/authoring-react/data-layer.ts
@@ -247,6 +247,9 @@ export const authoringStorageIArticle: IAuthoringStorage<IArticle> = {
 
             let diff = generatePatch(original, _current);
 
+            // Object patching is overriding fields of object type with diff.
+            // If we make changes to such a field it is not saved correctly.
+            // So we need to add all fields which are of object type to the diff object.
             Object.keys(diff).forEach((key) => {
                 if (isObject(diff[key])) {
                     diff[key] = _current[key];
diff --git a/scripts/apps/authoring/metadata/PlacesService.ts b/scripts/apps/authoring/metadata/PlacesService.ts
index e69d8e49b5..477ec544e3 100644
--- a/scripts/apps/authoring/metadata/PlacesService.ts
+++ b/scripts/apps/authoring/metadata/PlacesService.ts
@@ -71,7 +71,7 @@ export default function PlacesServiceFactory(api, features, metadata) {
     class PlacesService implements IPlacesService {
         searchDateline(query: string, lang: string) {
             return this._searchGeonames(query, lang, true)
-                .then((geonames) => geonames.map(geoNameToCity))
+                .then((geonames) => geonames.map((x) => geoNameToCity(x)))
                 .catch(() => this._searchCities(query));
         }
 
diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts
index 0aa44253dd..6beacdf7d2 100644
--- a/scripts/core/superdesk-api.d.ts
+++ b/scripts/core/superdesk-api.d.ts
@@ -248,7 +248,6 @@ declare module 'superdesk-api' {
     }
 
     export type IDatelineValueOperational = {
-        day?: string;
         date?: string;
         source?: string;
         located?: ILocated;