From 7dfd9d71ecb45ea6ae8e07c7c9cda677a1b7ce0f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 30 Oct 2024 15:39:35 -0400 Subject: [PATCH] Replace `Oj` with plain `JSON` across db/ --- db/migrate/20180608213548_reject_following_blocked_users.rb | 2 +- db/migrate/20230215074423_move_user_settings.rb | 2 +- .../20240304090449_migrate_interaction_settings_to_policy.rb | 2 +- db/post_migrate/20230904134623_fix_kmr_locale_settings.rb | 4 ++-- ...0321160706_migrate_interaction_settings_to_policy_again.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/migrate/20180608213548_reject_following_blocked_users.rb b/db/migrate/20180608213548_reject_following_blocked_users.rb index 4cb6395469..6f22c8d00c 100644 --- a/db/migrate/20180608213548_reject_following_blocked_users.rb +++ b/db/migrate/20180608213548_reject_following_blocked_users.rb @@ -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) diff --git a/db/migrate/20230215074423_move_user_settings.rb b/db/migrate/20230215074423_move_user_settings.rb index 86231e49e8..6476afdbd3 100644 --- a/db/migrate/20230215074423_move_user_settings.rb +++ b/db/migrate/20230215074423_move_user_settings.rb @@ -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 diff --git a/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb b/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb index ea4cfccdf9..1736d1b17d 100644 --- a/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb +++ b/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb @@ -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 diff --git a/db/post_migrate/20230904134623_fix_kmr_locale_settings.rb b/db/post_migrate/20230904134623_fix_kmr_locale_settings.rb index 10e3f1da99..9df87b492d 100644 --- a/db/post_migrate/20230904134623_fix_kmr_locale_settings.rb +++ b/db/post_migrate/20230904134623_fix_kmr_locale_settings.rb @@ -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| diff --git a/db/post_migrate/20240321160706_migrate_interaction_settings_to_policy_again.rb b/db/post_migrate/20240321160706_migrate_interaction_settings_to_policy_again.rb index c789b63951..92dbd90c79 100644 --- a/db/post_migrate/20240321160706_migrate_interaction_settings_to_policy_again.rb +++ b/db/post_migrate/20240321160706_migrate_interaction_settings_to_policy_again.rb @@ -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?