From e3bbcb27d035dcac3163de9a5e3047ffc7239bbe Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 10 Mar 2020 16:57:14 +1000 Subject: [PATCH] FIX: Set current user timezone when saving profile timezone (#9155) If you are changing your own profile timezone, then on save we set the current user timezone, in case this property needs to be accessed again before the user is reloaded. --- .../discourse/controllers/preferences/profile.js.es6 | 6 ++++++ 1 file changed, 6 insertions(+) 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");