Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Davila <rdavila84@gmail.com>2017-09-07 17:10:39 +0300
committerRuben Davila <rdavila84@gmail.com>2017-09-07 17:11:52 +0300
commit26264625cbc2692bc113c1e701cb15eecbd010d2 (patch)
tree7833db383c1d1170f7c8a9a4f1131bec0e53943a /lib/gitlab/themes.rb
parent99dcf870dd46299ffec2e5067c9b3223de3315ce (diff)
Small refactor after last code review.
Diffstat (limited to 'lib/gitlab/themes.rb')
-rw-r--r--lib/gitlab/themes.rb10
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