From 3d2e18a6debd962aea3bab560c9ba5eab75e5a24 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Wed, 3 Aug 2022 14:25:17 +0200 Subject: [PATCH 1/3] Only save new TZ if automatic update set --- src/libs/actions/App.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index b36edc546300..fa0a15b4d9fe 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -210,10 +210,16 @@ function setUpPoliciesAndNavigate(session, currentPath) { function openProfile() { const oldTimezoneData = myPersonalDetails.timezone || {}; - const newTimezoneData = { - automatic: lodashGet(oldTimezoneData, 'automatic', true), - selected: moment.tz.guess(true), - }; + let newTimezoneData; + + if (lodashGet(oldTimezoneData, 'automatic', true)) { + newTimezoneData = { + automatic: true, + selected: moment.tz.guess(true), + }; + } else { + newTimezoneData = oldTimezoneData; + } API.write('OpenProfile', { timezone: JSON.stringify(newTimezoneData), From c148b74b799c6c075e7e681e703d9b8bdd36fa5f Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Wed, 3 Aug 2022 14:25:40 +0200 Subject: [PATCH 2/3] Remove trailing spaces --- src/libs/actions/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index fa0a15b4d9fe..25d14818f279 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -211,7 +211,7 @@ function setUpPoliciesAndNavigate(session, currentPath) { function openProfile() { const oldTimezoneData = myPersonalDetails.timezone || {}; let newTimezoneData; - + if (lodashGet(oldTimezoneData, 'automatic', true)) { newTimezoneData = { automatic: true, From e5758d5935487c3e98e3e073537aa739ef9af15a Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 4 Aug 2022 10:03:27 +0200 Subject: [PATCH 3/3] Init new tz with old tz --- src/libs/actions/App.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index 25d14818f279..e6914a2ceff0 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -210,15 +210,13 @@ function setUpPoliciesAndNavigate(session, currentPath) { function openProfile() { const oldTimezoneData = myPersonalDetails.timezone || {}; - let newTimezoneData; + let newTimezoneData = oldTimezoneData; if (lodashGet(oldTimezoneData, 'automatic', true)) { newTimezoneData = { automatic: true, selected: moment.tz.guess(true), }; - } else { - newTimezoneData = oldTimezoneData; } API.write('OpenProfile', {