summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-08-26 11:30:11 -0700
committerRobert Speicher <rspeicher@gmail.com>2015-08-26 11:30:11 -0700
commit6d43308b5a5ff7663e1782fd6f5493f48c0f7e2a (patch)
treeb1dfc9e59d537fb53a5edc9769168d6fd6575f47 /lib
parentd6a145d4b0b8d2baa63f2c1699ba44ea203a4ae8 (diff)
downloadgitlab-ce-6d43308b5a5ff7663e1782fd6f5493f48c0f7e2a.tar.gz
Add `Gitlab::Themes.for_user`
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/themes.rb13
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