diff options
author | Martin Kraft <martinkraft@gmail.com> | 2018-03-23 09:08:49 -0400 |
---|---|---|
committer | Martin Kraft <martinkraft@gmail.com> | 2018-03-23 09:08:49 -0400 |
commit | 5fa1b3581955761bd39c310bc88b1489d963a9fc (patch) | |
tree | 25e6dd11592102807abebbb5de100f7d867005d8 /app/timezone.go | |
parent | 37f0e5e0ebc0595efe2c65ffb84fa096dc8c5493 (diff) | |
parent | 87762ae62eb887dfb3fd0957040919aede46f7d4 (diff) | |
download | chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.gz chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.bz2 chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.zip |
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'app/timezone.go')
-rw-r--r-- | app/timezone.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/timezone.go b/app/timezone.go new file mode 100644 index 000000000..84d912da6 --- /dev/null +++ b/app/timezone.go @@ -0,0 +1,28 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package app + +import ( + "github.com/mattermost/mattermost-server/model" + "github.com/mattermost/mattermost-server/utils" +) + +func (a *App) Timezones() model.SupportedTimezones { + if cfg := a.timezones.Load(); cfg != nil { + return cfg.(model.SupportedTimezones) + } + return model.SupportedTimezones{} +} + +func (a *App) LoadTimezones() { + timezonePath := "timezones.json" + + if a.Config().TimezoneSettings.SupportedTimezonesPath != nil && len(*a.Config().TimezoneSettings.SupportedTimezonesPath) > 0 { + timezonePath = *a.Config().TimezoneSettings.SupportedTimezonesPath + } + + timezoneCfg := utils.LoadTimezones(timezonePath) + + a.timezones.Store(timezoneCfg) +} |