[GH24626] Remove ExperimentalTimezone as this is always true (#24657)

* Remove all occurrences of ExperimentalTimezone in /server

This removes all uses of ExperimentalTimezone and makes all conditions using this setting being either removed (== false) or always used (== true)

* Remove timezone parameter for getChannelMemberByGroup

As timezone is always enabled this function no longer has a second parameter. The endpoint will always be called with includeTimezones set to true

* Remove all uses of ExperimentalTimezone in webapp

All conditions dependent of this are adjusted to always be true if experimentalTimezone should be true and vice versa

* Change all tests checking for correct usage of ExperimentalTimezone

As this parameter is no longer used, the tests which check for correct behaviour of this is no longer needed

* Fix type errors

Tests regarding types does now pass

'npm run check-types' will run successfully

* fix lint issues

Fix all current lint errors and now lint test goes through

* Fix test regarding profile popover

enableTimezone now is gone and all profile_popover.test.tsx can run successfully.

Added state.entities.users.profiles[] as it before threw an error without it.

* Fix tests where "April 1 2019" was changed to "April 01 2019"

Now it will show "April 1 2019" and "timeZone" will only show if its other than empty ("").

* Fix test where date was set to NaN

Now date will show correctly and will not be NaN

* fix minor test case that failed before

* fix linting in server

* Delete tests that are not valid with timeZoneEnabled removed

tests in advanced_create_comment and advanced_create_post had timeZoneEnabled
set to false as default. The tests that use this are now changed to once which are meant to have timeZoneEnabled set to true.

Adjust jest function in advanced_create_post to get correct stacktrace

* Parameter deleted

isTimeZoneEnabled is always true and therefore the parameter can be deleted

* adjust to prettier standard

* Remove all occurrences of ExperimentalTimezone in /server

This removes all uses of ExperimentalTimezone and makes all conditions using this setting being either removed (== false) or always used (== true)

* Remove timezone parameter for getChannelMemberByGroup

As timezone is always enabled this function no longer has a second parameter. The endpoint will always be called with includeTimezones set to true

* Remove all uses of ExperimentalTimezone in webapp

All conditions dependent of this are adjusted to always be true if experimentalTimezone should be true and vice versa

* Change all tests checking for correct usage of ExperimentalTimezone

As this parameter is no longer used, the tests which check for correct behaviour of this is no longer needed

* Fix type errors

Tests regarding types does now pass

'npm run check-types' will run successfully

* fix lint issues

Fix all current lint errors and now lint test goes through

* Fix test regarding profile popover

enableTimezone now is gone and all profile_popover.test.tsx can run successfully.

Added state.entities.users.profiles[] as it before threw an error without it.

* Fix tests where "April 1 2019" was changed to "April 01 2019"

Now it will show "April 1 2019" and "timeZone" will only show if its other than empty ("").

* Fix test where date was set to NaN

Now date will show correctly and will not be NaN

* fix minor test case that failed before

* fix linting in server

* Delete tests that are not valid with timeZoneEnabled removed

tests in advanced_create_comment and advanced_create_post had timeZoneEnabled
set to false as default. The tests that use this are now changed to once which are meant to have timeZoneEnabled set to true.

Adjust jest function in advanced_create_post to get correct stacktrace

* Parameter deleted

isTimeZoneEnabled is always true and therefore the parameter can be deleted

* adjust to prettier standard

---------

Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
ludvigbolin
2023-10-30 20:31:05 +01:00
коммит произвёл GitHub
родитель af8c9ae0ca
Коммит 4547d9ab0e
46 изменённых файлов: 106 добавлений и 310 удалений

Просмотреть файл

@@ -59,7 +59,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
props["DisableAppBar"] = strconv.FormatBool(*c.ExperimentalSettings.DisableAppBar)
props["ExperimentalEnableAutomaticReplies"] = strconv.FormatBool(*c.TeamSettings.ExperimentalEnableAutomaticReplies)
props["ExperimentalTimezone"] = strconv.FormatBool(*c.DisplaySettings.ExperimentalTimezone)
props["ExperimentalTimezone"] = "true"
props["SendEmailNotifications"] = strconv.FormatBool(*c.EmailSettings.SendEmailNotifications)
props["SendPushNotifications"] = strconv.FormatBool(*c.EmailSettings.SendPushNotifications)

Просмотреть файл

@@ -80,9 +80,6 @@ func init() {
ServiceSettings: model.ServiceSettings{
SiteURL: model.NewString("http://custom.com"),
},
DisplaySettings: model.DisplaySettings{
ExperimentalTimezone: model.NewBool(false),
},
}
}

Просмотреть файл

@@ -153,7 +153,6 @@ func TestDatabaseStoreNew(t *testing.T) {
defer ds.Close()
assert.Equal(t, *customConfigDefaults.ServiceSettings.SiteURL, *ds.Get().ServiceSettings.SiteURL)
assert.Equal(t, *customConfigDefaults.DisplaySettings.ExperimentalTimezone, *ds.Get().DisplaySettings.ExperimentalTimezone)
})
t.Run("existing config, initialization required", func(t *testing.T) {
@@ -181,7 +180,6 @@ func TestDatabaseStoreNew(t *testing.T) {
assert.Equal(t, "http://TestStoreNew", *ds.Get().ServiceSettings.SiteURL)
// not existing value should be overwritten by the custom
// default value
assert.Equal(t, *customConfigDefaults.DisplaySettings.ExperimentalTimezone, *ds.Get().DisplaySettings.ExperimentalTimezone)
assertDatabaseNotEqualsConfig(t, testConfig)
})
@@ -208,7 +206,6 @@ func TestDatabaseStoreNew(t *testing.T) {
// as the whole config has default values already, custom
// defaults should have no effect
assert.Equal(t, "http://minimal", *ds.Get().ServiceSettings.SiteURL)
assert.NotEqual(t, *customConfigDefaults.DisplaySettings.ExperimentalTimezone, *ds.Get().DisplaySettings.ExperimentalTimezone)
assertDatabaseEqualsConfig(t, minimalConfigNoFF)
})

Просмотреть файл

@@ -125,7 +125,6 @@ func TestFileStoreNew(t *testing.T) {
assert.Equal(t, "http://TestStoreNew", *configStore.Get().ServiceSettings.SiteURL)
// nonexisting value should be overwritten by the custom
// defaults
assert.Equal(t, *customConfigDefaults.DisplaySettings.ExperimentalTimezone, *configStore.Get().DisplaySettings.ExperimentalTimezone)
assertFileNotEqualsConfig(t, testConfig, path)
})
@@ -156,7 +155,6 @@ func TestFileStoreNew(t *testing.T) {
// as the whole config has default values already, custom
// defaults should have no effect
assert.Equal(t, "http://minimal", *configStore.Get().ServiceSettings.SiteURL)
assert.NotEqual(t, *customConfigDefaults.DisplaySettings.ExperimentalTimezone, *configStore.Get().DisplaySettings.ExperimentalTimezone)
assertFileEqualsConfig(t, minimalConfigNoFF, path)
})
@@ -195,7 +193,6 @@ func TestFileStoreNew(t *testing.T) {
defer configStore.Close()
assert.Equal(t, *customConfigDefaults.ServiceSettings.SiteURL, *configStore.Get().ServiceSettings.SiteURL)
assert.Equal(t, *customConfigDefaults.DisplaySettings.ExperimentalTimezone, *configStore.Get().DisplaySettings.ExperimentalTimezone)
})
t.Run("absolute path, path to file does not exist", func(t *testing.T) {