Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 config.theme.timezone must not be overwritten #7232

Merged

Conversation

aileen
Copy link
Member

@aileen aileen commented Aug 19, 2016

closes #7182

When calling config.set() in the settings api, we want to set the active timezone of the blog to make it available in our settingsCache. But because the theme object in the set prototype was already set to Etc/UTC as default, the _.merge function would always overwrite our activeTimezone with the default value.

This PR changes the code in the way, that we always set 'Etc/UTC' for the timezone as default, until we fetched our settings and therefore the activeTimezone setting, so we can overwrite it.

This issue had not only influence on the date helper, but everywhere in our codebase, where we rely on reading the timezone from our config, instead of our settings. The {{@blog.timezone}} helper reflected that quiet well, as it would always show Etc/UTC

@kirrg001 kirrg001 self-assigned this Aug 19, 2016
@aileen aileen force-pushed the 7182-set-config-must-not-overwrite-timezone branch from ada417e to 5ddc490 Compare August 19, 2016 14:40
@aileen
Copy link
Member Author

aileen commented Aug 19, 2016

Ready for review and merge 馃帀

// Special case for theme.timezone, which should be overridden not merged
if (config && config.theme && config.theme.timezone) {
this._config.theme.timezone = config.theme.timezone;
} else if (this._config && this._config.theme) {

This comment was marked as abuse.

@aileen aileen force-pushed the 7182-set-config-must-not-overwrite-timezone branch 3 times, most recently from 10ace06 to 190fca1 Compare August 22, 2016 14:16
closes TryGhost#7182

When calling `config.set()` in the settings api, we want to set the active timezone of the blog to make it available in our `settingsCache`. But because the `theme` object in the `set` prototype was already set to `Etc/UTC` as default, the `_.merge` function would always overwrite our `activeTimezone` with the default value.

This PR changes the code in the way, that we always set 'Etc/UTC' for the timezone as default, _until_ we fetched our settings and therefore the `activeTimezone` setting, so we can overwrite it.

This issue had not only influence on the date helper, but everywhere in our codebase, where we rely on reading the `timezone` from our config, instead of our settings. The `{{@blog.timezone}}` helper reflected that quiet well, as it would always show `Etc/UTC`
@aileen aileen force-pushed the 7182-set-config-must-not-overwrite-timezone branch from 190fca1 to 41c7057 Compare August 22, 2016 15:36
@kirrg001 kirrg001 merged commit 2875f5a into TryGhost:master Aug 22, 2016
mixonic pushed a commit to mixonic/Ghost that referenced this pull request Oct 28, 2016
closes TryGhost#7182

When calling `config.set()` in the settings api, we want to set the active timezone of the blog to make it available in our `settingsCache`. But because the `theme` object in the `set` prototype was already set to `Etc/UTC` as default, the `_.merge` function would always overwrite our `activeTimezone` with the default value.

This PR changes the code in the way, that we always set 'Etc/UTC' for the timezone as default, _until_ we fetched our settings and therefore the `activeTimezone` setting, so we can overwrite it.

This issue had not only influence on the date helper, but everywhere in our codebase, where we rely on reading the `timezone` from our config, instead of our settings. The `{{@blog.timezone}}` helper reflected that quiet well, as it would always show `Etc/UTC`
geekhuyang pushed a commit to geekhuyang/Ghost that referenced this pull request Nov 20, 2016
closes TryGhost#7182

When calling `config.set()` in the settings api, we want to set the active timezone of the blog to make it available in our `settingsCache`. But because the `theme` object in the `set` prototype was already set to `Etc/UTC` as default, the `_.merge` function would always overwrite our `activeTimezone` with the default value.

This PR changes the code in the way, that we always set 'Etc/UTC' for the timezone as default, _until_ we fetched our settings and therefore the `activeTimezone` setting, so we can overwrite it.

This issue had not only influence on the date helper, but everywhere in our codebase, where we rely on reading the `timezone` from our config, instead of our settings. The `{{@blog.timezone}}` helper reflected that quiet well, as it would always show `Etc/UTC`
@aileen aileen deleted the 7182-set-config-must-not-overwrite-timezone branch October 13, 2017 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date helper is returning current dates with wrong timezone
2 participants