mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-19 21:33:21 +00:00
Move glitch-soc-specific theming methods to ThemingConcern
This commit is contained in:
parent
5f48ec9e42
commit
08f44d1953
|
@ -136,15 +136,6 @@ class ApplicationController < ActionController::Base
|
||||||
@current_session = SessionActivation.find_by(session_id: cookies.signed['_session_id']) if cookies.signed['_session_id'].present?
|
@current_session = SessionActivation.find_by(session_id: cookies.signed['_session_id']) if cookies.signed['_session_id'].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_flavour
|
|
||||||
[current_user&.setting_flavour, Setting.flavour, 'glitch', 'vanilla'].find { |flavour| Themes.instance.flavours.include?(flavour) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_skin
|
|
||||||
skins = Themes.instance.skins_for(current_flavour)
|
|
||||||
[current_user&.setting_skin, Setting.skin, 'default'].find { |skin| skins.include?(skin) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def respond_with_error(code)
|
def respond_with_error(code)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.any do
|
format.any do
|
||||||
|
|
|
@ -10,6 +10,15 @@ module ThemingConcern
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def current_flavour
|
||||||
|
[current_user&.setting_flavour, Setting.flavour, 'glitch', 'vanilla'].find { |flavour| Themes.instance.flavours.include?(flavour) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_skin
|
||||||
|
skins = Themes.instance.skins_for(current_flavour)
|
||||||
|
[current_user&.setting_skin, Setting.skin, 'default'].find { |skin| skins.include?(skin) }
|
||||||
|
end
|
||||||
|
|
||||||
def valid_pack_data?(data, pack_name)
|
def valid_pack_data?(data, pack_name)
|
||||||
data['pack'].is_a?(Hash) && [String, Hash].any? { |c| data['pack'][pack_name].is_a?(c) }
|
data['pack'].is_a?(Hash) && [String, Hash].any? { |c| data['pack'][pack_name].is_a?(c) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue