From 60fa4fe6929e406e944fa5a7818dd2d2cf3a8db8 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 8 Feb 2019 16:54:15 +0000 Subject: [PATCH] DEV: Make interface route/controller more resilient to missing values --- .../discourse/controllers/preferences/interface.js.es6 | 2 +- .../javascripts/discourse/routes/preferences-interface.js.es6 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 index e01c86c506b..8eec21b6be8 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 @@ -75,7 +75,7 @@ export default Ember.Controller.extend(PreferencesTabController, { @computed("model.user_option.theme_ids", "themeId") showThemeSetDefault(userOptionThemes, selectedTheme) { - return userOptionThemes[0] !== selectedTheme; + return !userOptionThemes || userOptionThemes[0] !== selectedTheme; }, @computed("model.user_option.text_size", "textSize") diff --git a/app/assets/javascripts/discourse/routes/preferences-interface.js.es6 b/app/assets/javascripts/discourse/routes/preferences-interface.js.es6 index ae5a103edfc..34976bbd825 100644 --- a/app/assets/javascripts/discourse/routes/preferences-interface.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-interface.js.es6 @@ -10,6 +10,7 @@ export default RestrictedUserRoute.extend({ textSize: user.get("currentTextSize"), themeId: currentThemeId(), makeThemeDefault: + !user.get("user_option.theme_ids") || currentThemeId() === user.get("user_option.theme_ids")[0], makeTextSizeDefault: user.get("currentTextSize") === user.get("user_option.text_size")