Merge commit 'd13d7b4566d551d027830f7dfc987ba3a8e2dd4f' into glitch-soc/merge-upstream
Conflicts are too numerous to list, but they are all caused by upstream's theming changes and all have to do with the differences between upstream and glitch-soc in the theming systems. They were all manually resolved by adapting the relevant code.
This commit is contained in:
commit
4fbd1ad7ae
41 files changed
+372
-243
No files matched your search
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MigrateDefaultThemeSetting < ActiveRecord::Migration[8.0]
|
||||
class Setting < ApplicationRecord; end
|
||||
|
||||
def up
|
||||
Setting.reset_column_information
|
||||
|
||||
setting = Setting.find_by(var: 'theme')
|
||||
return unless setting.present? && setting.attributes['value'].present?
|
||||
|
||||
theme = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol])
|
||||
return unless %w(mastodon-light contrast system).include?(theme)
|
||||
|
||||
setting.update_column('value', "--- default\n")
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MigrateUserTheme < ActiveRecord::Migration[8.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
# Dummy classes, to make migration possible across version changes
|
||||
class User < ApplicationRecord; end
|
||||
|
||||
def up
|
||||
User.where.not(settings: nil).find_each do |user|
|
||||
settings = Oj.load(user.attributes_before_type_cast['settings'])
|
||||
next if settings.nil? || settings['theme'].blank? || %w(system default mastodon-light contrast).exclude?(settings['theme'])
|
||||
|
||||
case settings['theme']
|
||||
when 'default'
|
||||
settings['web.color_scheme'] = 'dark'
|
||||
settings['web.contrast'] = 'auto'
|
||||
when 'contrast'
|
||||
settings['web.color_scheme'] = 'dark'
|
||||
settings['web.contrast'] = 'high'
|
||||
when 'mastodon-light'
|
||||
settings['web.color_scheme'] = 'light'
|
||||
settings['web.contrast'] = 'auto'
|
||||
end
|
||||
|
||||
settings['theme'] = 'default'
|
||||
|
||||
user.update_column('settings', Oj.dump(settings))
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user