diff options
author | Ruben Davila <rdavila84@gmail.com> | 2017-09-07 09:10:39 -0500 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-09-07 09:11:52 -0500 |
commit | 26264625cbc2692bc113c1e701cb15eecbd010d2 (patch) | |
tree | 7833db383c1d1170f7c8a9a4f1131bec0e53943a /lib | |
parent | 99dcf870dd46299ffec2e5067c9b3223de3315ce (diff) | |
download | gitlab-ce-26264625cbc2692bc113c1e701cb15eecbd010d2.tar.gz |
Small refactor after last code review.35012-navigation-add-option-to-change-navigation-color-palette
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/themes.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/gitlab/themes.rb b/lib/gitlab/themes.rb index 37054d98102..d43eff5ba4a 100644 --- a/lib/gitlab/themes.rb +++ b/lib/gitlab/themes.rb @@ -73,13 +73,11 @@ module Gitlab private def default_id - id = Gitlab.config.gitlab.default_theme.to_i + @default_id ||= begin + id = Gitlab.config.gitlab.default_theme.to_i + theme_ids = THEMES.map(&:id) - # Prevent an invalid configuration setting from causing an infinite loop - if id < THEMES.first.id || id > THEMES.last.id - APPLICATION_DEFAULT - else - id + theme_ids.include?(id) ? id : APPLICATION_DEFAULT end end end |