diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-08-26 21:30:11 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-08-26 21:30:11 +0300 |
commit | 6d43308b5a5ff7663e1782fd6f5493f48c0f7e2a (patch) | |
tree | b1dfc9e59d537fb53a5edc9769168d6fd6575f47 | |
parent | d6a145d4b0b8d2baa63f2c1699ba44ea203a4ae8 (diff) |
Add `Gitlab::Themes.for_user`
-rw-r--r-- | lib/gitlab/themes.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab/themes.rb b/lib/gitlab/themes.rb index 5209df92795..37a36b9599b 100644 --- a/lib/gitlab/themes.rb +++ b/lib/gitlab/themes.rb @@ -51,6 +51,19 @@ module Gitlab THEMES.each(&block) end + # Get the Theme for the specified user, or the default + # + # user - User record + # + # Returns a Theme + def self.for_user(user) + if user + by_id(user.theme_id) + else + default + end + end + private def self.default_id |