Skip to content

A platform for community discussion. Free, open, simple.

FIX: Set current user timezone when saving profile timezone (#9155)

Martin Brennane3bbcb27d035
diff --git a/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6
index 5d2e65f0450..f6005e355dc 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/profile.js.es6
@@ -93,6 +93,12 @@ export default Controller.extend(PreferencesTabController, {
return model
.save(this.saveAttrNames)
.then(() => {
+ // update the timezone in memory so we can use the new
+ // one if we change routes without reloading the user
+ if (this.currentUser.id === this.model.id) {
+ this.currentUser.timezone = this.model.user_option.timezone;
+ }
+
cookAsync(model.get("bio_raw"))
.then(() => {
model.set("bio_cooked");