From 9a8be8cf4976d1ccdc280a9c0adfc92e7a0205aa Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 27 Apr 2024 19:38:11 +0200 Subject: [PATCH] Remove theme fallback mechanism Remove the `fallback` property and do not fallback to using another flavour when a pack is not available in the selected flavour. Flavours should define all packs, and should they wish to piggy-back on another one, they can import that other one's pack explicitly instead. --- app/controllers/concerns/theming_concern.rb | 12 ------------ app/javascript/flavours/glitch/theme.yml | 7 ------- app/javascript/flavours/vanilla/theme.yml | 6 ------ 3 files changed, 25 deletions(-) diff --git a/app/controllers/concerns/theming_concern.rb b/app/controllers/concerns/theming_concern.rb index 5d24001bbf..4992788a04 100644 --- a/app/controllers/concerns/theming_concern.rb +++ b/app/controllers/concerns/theming_concern.rb @@ -65,18 +65,6 @@ module ThemingConcern return pack(data, pack_name, skin) if valid_pack_data?(data, pack_name) return if data['name'].blank? - fallbacks = [] - if data.key?('fallback') - fallbacks = data['fallback'] if data['fallback'].is_a?(Array) - fallbacks = [data['fallback']] if data['fallback'].is_a?(String) - elsif data['name'] != Setting.default_settings['flavour'] - fallbacks = [Setting.default_settings['flavour']] - end - - fallbacks.each do |fallback| - return resolve_pack(Themes.instance.flavour(fallback), pack_name, skin) if Themes.instance.flavour(fallback) - end - nil end diff --git a/app/javascript/flavours/glitch/theme.yml b/app/javascript/flavours/glitch/theme.yml index a037834e2b..670a163fcd 100644 --- a/app/javascript/flavours/glitch/theme.yml +++ b/app/javascript/flavours/glitch/theme.yml @@ -46,15 +46,8 @@ screenshot: flavours/glitch/images/glitch-preview.png # but in the case of the vanilla Mastodon flavour the pack files are # somewhere else. pack_directory: app/javascript/flavours/glitch/packs - # (OPTIONAL) The directory which contains the pack files. # Defaults to the theme directory (`app/javascript/themes/[theme]`), # which should be sufficient for like 99% of use-cases lol. # pack_directory: app/javascript/packs - -# (OPTIONAL) By default the theme will fallback to the default theme -# if a particular pack is not provided. You can specify different -# fallbacks here, or disable fallback behaviours altogether by -# specifying a `null` value. -fallback: diff --git a/app/javascript/flavours/vanilla/theme.yml b/app/javascript/flavours/vanilla/theme.yml index 553a202379..ea02dee6cf 100644 --- a/app/javascript/flavours/vanilla/theme.yml +++ b/app/javascript/flavours/vanilla/theme.yml @@ -41,9 +41,3 @@ screenshot: images/screenshot.png # but in the case of the vanilla Mastodon flavour the pack files are # somewhere else. pack_directory: app/javascript/packs - -# (OPTIONAL) By default the theme will fallback to the default flavour -# if a particular pack is not provided. You can specify different -# fallbacks here, or disable fallback behaviours altogether by -# specifying a `null` value. -fallback: