Move theme-related helper methods out of controller (#37807)

This commit is contained in:
Matt Jankowski
2026-02-10 10:34:42 -05:00
committed by GitHub
parent 040555be7f
commit 34514bcfe9
5 changed files with 72 additions and 37 deletions

View File

@@ -17,9 +17,6 @@ class ApplicationController < ActionController::Base
helper_method :current_account
helper_method :current_session
helper_method :current_theme
helper_method :color_scheme
helper_method :contrast
helper_method :single_user_mode?
helper_method :use_seamless_external_login?
helper_method :sso_account_settings
@@ -173,20 +170,6 @@ class ApplicationController < ActionController::Base
@current_session = SessionActivation.find_by(session_id: cookies.signed['_session_id']) if cookies.signed['_session_id'].present?
end
def current_theme
return Setting.theme unless Themes.instance.names.include? current_user&.setting_theme
current_user.setting_theme
end
def color_scheme
current_user&.setting_color_scheme || 'auto'
end
def contrast
current_user&.setting_contrast || 'auto'
end
def respond_with_error(code)
respond_to do |format|
format.any { render "errors/#{code}", layout: 'error', status: code, formats: [:html] }