]> cat aescling's git repositories - mastodon.git/blobdiff - app/controllers/application_controller.rb
Add support for multiple themes (#4959)
[mastodon.git] / app / controllers / application_controller.rb
index 0b40fb05b730f349790785781294e529cf06f541..d5eca6ffb601254cb991ef67c62c18b108e8d7bf 100644 (file)
@@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base
 
   helper_method :current_account
   helper_method :current_session
+  helper_method :current_theme
   helper_method :single_user_mode?
 
   rescue_from ActionController::RoutingError, with: :not_found
@@ -77,6 +78,11 @@ class ApplicationController < ActionController::Base
     @current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
   end
 
+  def current_theme
+    return Setting.default_settings['theme'] unless Themes.instance.names.include? current_user&.setting_theme
+    current_user.setting_theme
+  end
+
   def cache_collection(raw, klass)
     return raw unless klass.respond_to?(:with_includes)
 
This page took 0.063045 seconds and 4 git commands to generate.