DEV: Make interface route/controller more resilient to missing values

This commit is contained in:
David Taylor 2019-02-08 16:54:15 +00:00
parent 0d1fa54957
commit 60fa4fe692
2 changed files with 2 additions and 1 deletions

View File

@ -75,7 +75,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
@computed("model.user_option.theme_ids", "themeId") @computed("model.user_option.theme_ids", "themeId")
showThemeSetDefault(userOptionThemes, selectedTheme) { showThemeSetDefault(userOptionThemes, selectedTheme) {
return userOptionThemes[0] !== selectedTheme; return !userOptionThemes || userOptionThemes[0] !== selectedTheme;
}, },
@computed("model.user_option.text_size", "textSize") @computed("model.user_option.text_size", "textSize")

View File

@ -10,6 +10,7 @@ export default RestrictedUserRoute.extend({
textSize: user.get("currentTextSize"), textSize: user.get("currentTextSize"),
themeId: currentThemeId(), themeId: currentThemeId(),
makeThemeDefault: makeThemeDefault:
!user.get("user_option.theme_ids") ||
currentThemeId() === user.get("user_option.theme_ids")[0], currentThemeId() === user.get("user_option.theme_ids")[0],
makeTextSizeDefault: makeTextSizeDefault:
user.get("currentTextSize") === user.get("user_option.text_size") user.get("currentTextSize") === user.get("user_option.text_size")