1
0
mirror of https://github.com/mastodon/mastodon synced 2024-12-03 01:08:23 +09:00

Replace Oj with plain JSON across db/

This commit is contained in:
Matt Jankowski 2024-10-30 15:39:35 -04:00
parent 0742632007
commit 58bf81af7a
5 changed files with 6 additions and 6 deletions

View File

@ -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.dump(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)

View File

@ -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.dump(user_settings))
end
end
end

View File

@ -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

View File

@ -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.dump(user_settings))
end
MigrationUser.where.not(chosen_languages: nil).where('chosen_languages && ?', '{kmr}').find_each do |user|

View File

@ -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?