diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-05 13:24:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-05 13:24:05 +0100 |
commit | 24d1ddcc24996d0b9de11fa725f0e15c78d59fba (patch) | |
tree | 02cce57e848d0f47e8583bf9f73cccb3cb40839d /app/controllers/concerns/theming_concern.rb | |
parent | 73b730e649555c9b0d2419130c5496e715fd3387 (diff) | |
parent | 08f44d1953d465825fd250452efbca6fc8d82dc3 (diff) |
Merge pull request #1678 from ClearlyClaire/glitch-soc/fixes/robust-theme-fallback
Make theme-selection fall back to default ones if configured is not found
Diffstat (limited to 'app/controllers/concerns/theming_concern.rb')
-rw-r--r-- | app/controllers/concerns/theming_concern.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/concerns/theming_concern.rb b/app/controllers/concerns/theming_concern.rb index 1ee3256c0..425554072 100644 --- a/app/controllers/concerns/theming_concern.rb +++ b/app/controllers/concerns/theming_concern.rb @@ -10,6 +10,15 @@ module ThemingConcern 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) data['pack'].is_a?(Hash) && [String, Hash].any? { |c| data['pack'][pack_name].is_a?(c) } end |