mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-21 18:05:23 -05:00
Use JSON.generate in db migrations (#38241)
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Crowdin / Upload translations / upload-translations (push) Waiting to run
Check formatting / lint (push) Waiting to run
CSS Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Crowdin / Upload translations / upload-translations (push) Waiting to run
Check formatting / lint (push) Waiting to run
CSS Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
This commit is contained in:
parent
653161fecc
commit
f5619fc8bc
|
|
@ -28,7 +28,7 @@ class RejectFollowingBlockedUsers < ActiveRecord::Migration[5.2]
|
|||
|
||||
next follow.destroy! if blocked_account.local?
|
||||
|
||||
reject_follow_json = Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(follow, serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(followed_account))
|
||||
reject_follow_json = JSON.generate(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(follow, serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(followed_account))
|
||||
|
||||
ActivityPub::DeliveryWorker.perform_async(reject_follow_json, followed_account, blocked_account.inbox_url)
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class MoveUserSettings < ActiveRecord::Migration[6.1]
|
|||
end
|
||||
end
|
||||
|
||||
user.update_column('settings', Oj.dump(user_settings))
|
||||
user.update_column('settings', JSON.generate(user_settings))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class MigrateInteractionSettingsToPolicy < ActiveRecord::Migration[7.1]
|
|||
private
|
||||
|
||||
def policy_for_user(user)
|
||||
deserialized_settings = Oj.load(user.attributes_before_type_cast['settings'])
|
||||
deserialized_settings = JSON.parse(user.attributes_before_type_cast['settings'])
|
||||
return if deserialized_settings.nil?
|
||||
|
||||
requires_new_policy = false
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class FillDefaultQuotePolicySetting < ActiveRecord::Migration[8.0]
|
|||
|
||||
def up
|
||||
User.where.not(settings: nil).find_each do |user|
|
||||
settings = Oj.load(user.attributes_before_type_cast['settings'])
|
||||
settings = JSON.parse(user.attributes_before_type_cast['settings'])
|
||||
next if settings.nil?
|
||||
|
||||
should_update_settings = false
|
||||
|
|
@ -26,7 +26,7 @@ class FillDefaultQuotePolicySetting < ActiveRecord::Migration[8.0]
|
|||
should_update_settings = true
|
||||
end
|
||||
|
||||
user.update_column('settings', Oj.dump(settings)) if should_update_settings
|
||||
user.update_column('settings', JSON.generate(settings)) if should_update_settings
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class MigrateUserTheme < ActiveRecord::Migration[8.0]
|
|||
|
||||
def up
|
||||
User.where.not(settings: nil).find_each do |user|
|
||||
settings = Oj.load(user.attributes_before_type_cast['settings'])
|
||||
settings = JSON.parse(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']
|
||||
|
|
@ -25,7 +25,7 @@ class MigrateUserTheme < ActiveRecord::Migration[8.0]
|
|||
|
||||
settings['theme'] = 'default'
|
||||
|
||||
user.update_column('settings', Oj.dump(settings))
|
||||
user.update_column('settings', JSON.generate(settings))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ class FixKmrLocaleSettings < ActiveRecord::Migration[7.0]
|
|||
MigrationUser.reset_column_information
|
||||
|
||||
MigrationUser.where.not(settings: [nil, '{}']).find_each do |user|
|
||||
user_settings = Oj.load(user.settings)
|
||||
user_settings = JSON.parse(user.settings)
|
||||
next unless user_settings['default_language'] == 'kmr'
|
||||
|
||||
user_settings['default_language'] = 'ku'
|
||||
user.update!(settings: Oj.dump(user_settings))
|
||||
user.update!(settings: JSON.generate(user_settings))
|
||||
end
|
||||
|
||||
MigrationUser.where.not(chosen_languages: nil).where('chosen_languages && ?', '{kmr}').find_each do |user|
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class MigrateInteractionSettingsToPolicyAgain < ActiveRecord::Migration[7.1]
|
|||
private
|
||||
|
||||
def policy_for_user(user)
|
||||
deserialized_settings = Oj.load(user.attributes_before_type_cast['settings'])
|
||||
deserialized_settings = JSON.parse(user.attributes_before_type_cast['settings'])
|
||||
return if deserialized_settings.nil?
|
||||
return if user.notification_policy.present?
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user