FIX: Don't override timezone on every visit of profile preferences

The timezone should only be initialized when there is no timezone stored in the DB yet. This also fixes an error that happened in dev mode whenever you switch between user preference tabs.
This commit is contained in:
Gerhard Schlager 2020-01-17 22:34:18 +01:00
parent 0d08eac1c7
commit 3fc589f875
1 changed files with 4 additions and 2 deletions

View File

@ -3,8 +3,10 @@ import RestrictedUserRoute from "discourse/routes/restricted-user";
export default RestrictedUserRoute.extend({ export default RestrictedUserRoute.extend({
showFooter: true, showFooter: true,
setupController(controller, model) { setupController(controller, model) {
model.user_option.timezone = if (!model.user_option.timezone) {
model.user_option.timezone || moment.tz.guess(); Ember.set(model, "user_option.timezone", moment.tz.guess());
}
controller.set("model", model); controller.set("model", model);
} }
}); });