diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-04 01:59:35 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-04 01:59:35 -0700 |
commit | 2c69ced3343d865bab613c6f76e5c6066b4f29b3 (patch) | |
tree | 156b071a164ad4950aced257783663a47d1327f7 /app | |
parent | d62bf7432ce8d125f81897644a903602b98a715f (diff) | |
parent | 336750c916498e99505f593067d4eeadccb3c261 (diff) | |
download | gitlab-ce-2c69ced3343d865bab613c6f76e5c6066b4f29b3.tar.gz |
Merge pull request #4177 from docwhat/fix-user_color_scheme_class
user_color_scheme_class with no current_user
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4c0bbf813bd..488a55b2e6c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,6 +2,13 @@ require 'digest/md5' require 'uri' module ApplicationHelper + COLOR_SCHEMES = { + 1 => 'white', + 2 => 'black', + 3 => 'solarized-dark', + 4 => 'monokai', + } + COLOR_SCHEMES.default = 'white' # Check if a particular controller is the current one # @@ -124,17 +131,7 @@ module ApplicationHelper end def user_color_scheme_class - # in case we dont have current_user (ex. in mailer) - return 1 unless defined?(current_user) - - case current_user.color_scheme_id - when 1 then 'white' - when 2 then 'black' - when 3 then 'solarized-dark' - when 4 then 'monokai' - else - 'white' - end + COLOR_SCHEMES[current_user.try(:color_scheme_id)] end # Define whenever show last push event |