From 074263200751ce2debb071a67e1d03a27755e9f5 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 30 Oct 2024 15:37:58 -0400 Subject: [PATCH] Replace `Oj` with plain `JSON` across app/ --- app/controllers/activitypub/inboxes_controller.rb | 2 +- app/controllers/api/v1/accounts_controller.rb | 2 +- app/controllers/api/v1/markers_controller.rb | 2 +- app/controllers/api/v1/statuses/pins_controller.rb | 4 ++-- app/helpers/jsonld_helper.rb | 2 +- app/helpers/react_component_helper.rb | 4 ++-- app/lib/access_token_extension.rb | 2 +- app/lib/activitypub/activity/create.rb | 2 +- app/lib/activitypub/activity/follow.rb | 2 +- app/lib/activitypub/forwarder.rb | 2 +- .../dimension/software_versions_dimension.rb | 2 +- app/lib/application_extension.rb | 2 +- app/lib/feed_manager.rb | 4 ++-- app/lib/link_details_extractor.rb | 2 +- app/lib/translation_service/deepl.rb | 4 ++-- app/lib/translation_service/libre_translate.rb | 6 +++--- app/lib/user_settings_serializer.rb | 4 ++-- app/lib/video_metadata_extractor.rb | 2 +- app/lib/webfinger.rb | 2 +- app/lib/webhooks/payload_renderer.rb | 4 ++-- app/models/custom_filter.rb | 4 ++-- app/models/relay.rb | 4 ++-- app/models/user.rb | 2 +- .../activitypub/process_collection_service.rb | 2 +- .../activitypub/synchronize_followers_service.rb | 2 +- .../after_block_domain_from_account_service.rb | 2 +- app/services/authorize_follow_service.rb | 2 +- app/services/backup_service.rb | 14 +++++++------- app/services/batched_remove_status_service.rb | 2 +- app/services/block_service.rb | 2 +- app/services/create_featured_tag_service.rb | 2 +- app/services/delete_account_service.rb | 6 +++--- app/services/fan_out_on_write_service.rb | 2 +- app/services/favourite_service.rb | 2 +- app/services/fetch_oembed_service.rb | 2 +- app/services/follow_service.rb | 2 +- app/services/notify_service.rb | 2 +- app/services/reblog_service.rb | 2 +- app/services/reject_follow_service.rb | 2 +- .../remove_domains_from_followers_service.rb | 2 +- app/services/remove_featured_tag_service.rb | 2 +- app/services/remove_from_followers_service.rb | 2 +- app/services/remove_status_service.rb | 4 ++-- app/services/report_service.rb | 2 +- app/services/software_update_check_service.rb | 2 +- app/services/suspend_account_service.rb | 4 ++-- app/services/unblock_service.rb | 2 +- app/services/unfavourite_service.rb | 2 +- app/services/unfollow_service.rb | 4 ++-- app/services/unsuspend_account_service.rb | 2 +- app/services/vote_service.rb | 2 +- app/services/webhook_service.rb | 2 +- app/validators/reaction_validator.rb | 2 +- app/views/shared/_web_app.html.haml | 2 +- app/views/shares/show.html.haml | 2 +- app/views/statuses/embed.html.haml | 2 +- .../activitypub/distribute_poll_update_worker.rb | 2 +- app/workers/activitypub/distribution_worker.rb | 2 +- .../activitypub/move_distribution_worker.rb | 2 +- .../activitypub/update_distribution_worker.rb | 2 +- .../publish_announcement_reaction_worker.rb | 2 +- .../publish_scheduled_announcement_worker.rb | 2 +- app/workers/push_conversation_worker.rb | 2 +- app/workers/push_update_worker.rb | 2 +- app/workers/scheduler/self_destruct_scheduler.rb | 2 +- app/workers/unfilter_notifications_worker.rb | 2 +- app/workers/unpublish_announcement_worker.rb | 2 +- app/workers/web/push_notification_worker.rb | 2 +- 68 files changed, 89 insertions(+), 89 deletions(-) diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb index 49cfc8ad1c..43a640501c 100644 --- a/app/controllers/activitypub/inboxes_controller.rb +++ b/app/controllers/activitypub/inboxes_controller.rb @@ -21,7 +21,7 @@ class ActivityPub::InboxesController < ActivityPub::BaseController end def unknown_affected_account? - json = Oj.load(body, mode: :strict) + json = JSON.parse(body) json.is_a?(Hash) && %w(Delete Update).include?(json['type']) && json['actor'].present? && json['actor'] == value_or_id(json['object']) && !Account.exists?(uri: json['actor']) rescue Oj::ParseError false diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index f7d3de7f94..3d81e22c55 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -37,7 +37,7 @@ class Api::V1::AccountsController < Api::BaseController headers.merge!(response.headers) - self.response_body = Oj.dump(response.body) + self.response_body = JSON.dump(response.body) self.status = response.status rescue ActiveRecord::RecordInvalid => e render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: 422 diff --git a/app/controllers/api/v1/markers_controller.rb b/app/controllers/api/v1/markers_controller.rb index 8eaf7767df..8422e9fa94 100644 --- a/app/controllers/api/v1/markers_controller.rb +++ b/app/controllers/api/v1/markers_controller.rb @@ -38,7 +38,7 @@ class Api::V1::MarkersController < Api::BaseController serialized[key] = ActiveModelSerializers::SerializableResource.new(value, serializer: REST::MarkerSerializer).as_json end - Oj.dump(serialized) + JSON.dump(serialized) end def resource_params diff --git a/app/controllers/api/v1/statuses/pins_controller.rb b/app/controllers/api/v1/statuses/pins_controller.rb index 7107890af1..1208cd35d3 100644 --- a/app/controllers/api/v1/statuses/pins_controller.rb +++ b/app/controllers/api/v1/statuses/pins_controller.rb @@ -30,7 +30,7 @@ class Api::V1::Statuses::PinsController < Api::V1::Statuses::BaseController adapter: ActivityPub::Adapter ).as_json - ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account.id) + ActivityPub::RawDistributionWorker.perform_async(JSON.dump(json), current_account.id) end def distribute_remove_activity! @@ -40,6 +40,6 @@ class Api::V1::Statuses::PinsController < Api::V1::Statuses::BaseController adapter: ActivityPub::Adapter ).as_json - ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account.id) + ActivityPub::RawDistributionWorker.perform_async(JSON.dump(json), current_account.id) end end diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb index ba096427cf..45762abf2a 100644 --- a/app/helpers/jsonld_helper.rb +++ b/app/helpers/jsonld_helper.rb @@ -191,7 +191,7 @@ module JsonLdHelper end def body_to_json(body, compare_id: nil) - json = body.is_a?(String) ? Oj.load(body, mode: :strict) : body + json = body.is_a?(String) ? JSON.parse(body) : body return if compare_id.present? && json['id'] != compare_id diff --git a/app/helpers/react_component_helper.rb b/app/helpers/react_component_helper.rb index 821a6f1e2d..ca0f96b4eb 100644 --- a/app/helpers/react_component_helper.rb +++ b/app/helpers/react_component_helper.rb @@ -2,7 +2,7 @@ module ReactComponentHelper def react_component(name, props = {}, &block) - data = { component: name.to_s.camelcase, props: Oj.dump(props) } + data = { component: name.to_s.camelcase, props: JSON.dump(props) } if block.nil? div_tag_with_data(data) else @@ -11,7 +11,7 @@ module ReactComponentHelper end def react_admin_component(name, props = {}) - data = { 'admin-component': name.to_s.camelcase, props: Oj.dump(props) } + data = { 'admin-component': name.to_s.camelcase, props: JSON.dump(props) } div_tag_with_data(data) end diff --git a/app/lib/access_token_extension.rb b/app/lib/access_token_extension.rb index 6e06f988a5..0ef299dbd3 100644 --- a/app/lib/access_token_extension.rb +++ b/app/lib/access_token_extension.rb @@ -24,6 +24,6 @@ module AccessTokenExtension end def push_to_streaming_api - redis.publish("timeline:access_token:#{id}", Oj.dump(event: :kill)) if revoked? || destroyed? + redis.publish("timeline:access_token:#{id}", JSON.dump(event: :kill)) if revoked? || destroyed? end end diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 85a66c6852..64fe0c5d3a 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -416,7 +416,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity def forward_for_reply return unless @status.distributable? && @json['signature'].present? && reply_to_local? - ActivityPub::RawDistributionWorker.perform_async(Oj.dump(@json), replied_to_status.account_id, [@account.preferred_inbox_url]) + ActivityPub::RawDistributionWorker.perform_async(JSON.dump(@json), replied_to_status.account_id, [@account.preferred_inbox_url]) end def increment_voters_count! diff --git a/app/lib/activitypub/activity/follow.rb b/app/lib/activitypub/activity/follow.rb index 97e41ab789..52d2b34f87 100644 --- a/app/lib/activitypub/activity/follow.rb +++ b/app/lib/activitypub/activity/follow.rb @@ -39,7 +39,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity end def reject_follow_request!(target_account) - json = Oj.dump(serialize_payload(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), ActivityPub::RejectFollowSerializer)) + json = JSON.dump(serialize_payload(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), ActivityPub::RejectFollowSerializer)) ActivityPub::DeliveryWorker.perform_async(json, target_account.id, @account.inbox_url) end end diff --git a/app/lib/activitypub/forwarder.rb b/app/lib/activitypub/forwarder.rb index 3a94f9669a..ac16be31be 100644 --- a/app/lib/activitypub/forwarder.rb +++ b/app/lib/activitypub/forwarder.rb @@ -20,7 +20,7 @@ class ActivityPub::Forwarder private def payload - @payload ||= Oj.dump(@json) + @payload ||= JSON.dump(@json) end def reblogged_by_account_ids diff --git a/app/lib/admin/metrics/dimension/software_versions_dimension.rb b/app/lib/admin/metrics/dimension/software_versions_dimension.rb index 84ffc41d74..bd79e25c9e 100644 --- a/app/lib/admin/metrics/dimension/software_versions_dimension.rb +++ b/app/lib/admin/metrics/dimension/software_versions_dimension.rb @@ -106,7 +106,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim def ffmpeg_version version_output = Terrapin::CommandLine.new(Rails.configuration.x.ffprobe_binary, '-show_program_version -v 0 -of json').run - version = Oj.load(version_output, mode: :strict, symbol_keys: true).dig(:program_version, :version) + version = JSON.parse(version_output, symbolize_names: true).dig(:program_version, :version) { key: 'ffmpeg', diff --git a/app/lib/application_extension.rb b/app/lib/application_extension.rb index d7aaeba5bd..b5a4c8f690 100644 --- a/app/lib/application_extension.rb +++ b/app/lib/application_extension.rb @@ -31,7 +31,7 @@ module ApplicationExtension def close_streaming_sessions(resource_owner = nil) # TODO: #28793 Combine into a single topic - payload = Oj.dump(event: :kill) + payload = JSON.dump(event: :kill) scope = access_tokens scope = scope.where(resource_owner_id: resource_owner.id) unless resource_owner.nil? scope.in_batches do |tokens| diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 74bf534e80..2969130800 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -74,7 +74,7 @@ class FeedManager def unpush_from_home(account, status, update: false) return false unless remove_from_feed(:home, account.id, status, aggregate_reblogs: account.user&.aggregates_reblogs?) - redis.publish("timeline:#{account.id}", Oj.dump(event: :delete, payload: status.id.to_s)) unless update + redis.publish("timeline:#{account.id}", JSON.dump(event: :delete, payload: status.id.to_s)) unless update true end @@ -101,7 +101,7 @@ class FeedManager def unpush_from_list(list, status, update: false) return false unless remove_from_feed(:list, list.id, status, aggregate_reblogs: list.account.user&.aggregates_reblogs?) - redis.publish("timeline:list:#{list.id}", Oj.dump(event: :delete, payload: status.id.to_s)) unless update + redis.publish("timeline:list:#{list.id}", JSON.dump(event: :delete, payload: status.id.to_s)) unless update true end diff --git a/app/lib/link_details_extractor.rb b/app/lib/link_details_extractor.rb index fe7f23f481..91729e55df 100644 --- a/app/lib/link_details_extractor.rb +++ b/app/lib/link_details_extractor.rb @@ -101,7 +101,7 @@ class LinkDetailsExtractor end def json - @json ||= root_array(Oj.load(@data)).compact.find { |obj| SUPPORTED_TYPES.include?(obj['@type']) } || {} + @json ||= root_array(JSON.parse(@data)).compact.find { |obj| SUPPORTED_TYPES.include?(obj['@type']) } || {} end end diff --git a/app/lib/translation_service/deepl.rb b/app/lib/translation_service/deepl.rb index 7761dbe626..59c255a7ce 100644 --- a/app/lib/translation_service/deepl.rb +++ b/app/lib/translation_service/deepl.rb @@ -31,7 +31,7 @@ class TranslationService::DeepL < TranslationService def fetch_languages(type) request(:get, "/v2/languages?type=#{type}") do |res| - Oj.load(res.body_with_limit).map { |language| normalize_language(language['language']) } + JSON.parse(res.body_with_limit).map { |language| normalize_language(language['language']) } end end @@ -68,7 +68,7 @@ class TranslationService::DeepL < TranslationService end def transform_response(json) - data = Oj.load(json, mode: :strict) + data = JSON.parse(json) raise UnexpectedResponseError unless data.is_a?(Hash) data['translations'].map do |translation| diff --git a/app/lib/translation_service/libre_translate.rb b/app/lib/translation_service/libre_translate.rb index 0df8590f87..8d6472c215 100644 --- a/app/lib/translation_service/libre_translate.rb +++ b/app/lib/translation_service/libre_translate.rb @@ -9,7 +9,7 @@ class TranslationService::LibreTranslate < TranslationService end def translate(texts, source_language, target_language) - body = Oj.dump(q: texts, source: source_language.presence || 'auto', target: target_language, format: 'html', api_key: @api_key) + body = JSON.dump(q: texts, source: source_language.presence || 'auto', target: target_language, format: 'html', api_key: @api_key) request(:post, '/translate', body: body) do |res| transform_response(res.body_with_limit, source_language) end @@ -17,7 +17,7 @@ class TranslationService::LibreTranslate < TranslationService def languages request(:get, '/languages') do |res| - languages = Oj.load(res.body_with_limit).to_h do |language| + languages = JSON.parse(res.body_with_limit).to_h do |language| [language['code'], language['targets'].without(language['code'])] end languages[nil] = languages.values.flatten.uniq.sort @@ -45,7 +45,7 @@ class TranslationService::LibreTranslate < TranslationService end def transform_response(json, source_language) - data = Oj.load(json, mode: :strict) + data = JSON.parse(json) raise UnexpectedResponseError unless data.is_a?(Hash) data['translatedText'].map.with_index do |text, index| diff --git a/app/lib/user_settings_serializer.rb b/app/lib/user_settings_serializer.rb index 10d1be04d5..f393aa4a8e 100644 --- a/app/lib/user_settings_serializer.rb +++ b/app/lib/user_settings_serializer.rb @@ -6,7 +6,7 @@ class UserSettingsSerializer if value.blank? {} else - Oj.load(value, symbol_keys: true) + JSON.parse(value, symbolize_names: true) end end @@ -14,6 +14,6 @@ class UserSettingsSerializer end def self.dump(value) - Oj.dump(value.as_json) + JSON.dump(value.as_json) end end diff --git a/app/lib/video_metadata_extractor.rb b/app/lib/video_metadata_extractor.rb index fda6405121..6efc853fcb 100644 --- a/app/lib/video_metadata_extractor.rb +++ b/app/lib/video_metadata_extractor.rb @@ -6,7 +6,7 @@ class VideoMetadataExtractor def initialize(path) @path = path - @metadata = Oj.load(ffmpeg_command_output, mode: :strict, symbol_keys: true) + @metadata = JSON.parse(ffmpeg_command_output, symbolize_names: true) parse_metadata rescue Terrapin::ExitStatusError, Oj::ParseError diff --git a/app/lib/webfinger.rb b/app/lib/webfinger.rb index 01a5dbc21d..6e13d2f163 100644 --- a/app/lib/webfinger.rb +++ b/app/lib/webfinger.rb @@ -12,7 +12,7 @@ class Webfinger def initialize(uri, body) @uri = uri - @json = Oj.load(body, mode: :strict) + @json = JSON.parse(body) validate_response! end diff --git a/app/lib/webhooks/payload_renderer.rb b/app/lib/webhooks/payload_renderer.rb index 3d2731f6dc..a7f17848ac 100644 --- a/app/lib/webhooks/payload_renderer.rb +++ b/app/lib/webhooks/payload_renderer.rb @@ -10,7 +10,7 @@ class Webhooks::PayloadRenderer def get(path) value = @document.dig(*parse_path(path)) - string = Oj.dump(value) + string = JSON.dump(value) # We want to make sure people can use the variable inside # other strings, so it can't be wrapped in quotes. @@ -58,7 +58,7 @@ class Webhooks::PayloadRenderer /iox def initialize(json) - @document = DocumentTraverser.new(Oj.load(json)) + @document = DocumentTraverser.new(JSON.parse(json)) end def render(template) diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb index bacf158261..5065bbd948 100644 --- a/app/models/custom_filter.rb +++ b/app/models/custom_filter.rb @@ -112,8 +112,8 @@ class CustomFilter < ApplicationRecord @should_invalidate_cache = false Rails.cache.delete("filters:v3:#{account_id}") - redis.publish("timeline:#{account_id}", Oj.dump(event: :filters_changed)) - redis.publish("timeline:system:#{account_id}", Oj.dump(event: :filters_changed)) + redis.publish("timeline:#{account_id}", JSON.dump(event: :filters_changed)) + redis.publish("timeline:system:#{account_id}", JSON.dump(event: :filters_changed)) end private diff --git a/app/models/relay.rb b/app/models/relay.rb index 1a8fdebc7f..1b63eb830d 100644 --- a/app/models/relay.rb +++ b/app/models/relay.rb @@ -31,7 +31,7 @@ class Relay < ApplicationRecord def enable! activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil) - payload = Oj.dump(follow_activity(activity_id)) + payload = JSON.dump(follow_activity(activity_id)) update!(state: :pending, follow_activity_id: activity_id) DeliveryFailureTracker.reset!(inbox_url) @@ -40,7 +40,7 @@ class Relay < ApplicationRecord def disable! activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil) - payload = Oj.dump(unfollow_activity(activity_id)) + payload = JSON.dump(unfollow_activity(activity_id)) update!(state: :idle, follow_activity_id: nil) DeliveryFailureTracker.reset!(inbox_url) diff --git a/app/models/user.rb b/app/models/user.rb index 310ec77a15..7ec954d06e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -359,7 +359,7 @@ class User < ApplicationRecord # Revoke each access token for the Streaming API, since `update_all`` # doesn't trigger ActiveRecord Callbacks: # TODO: #28793 Combine into a single topic - payload = Oj.dump(event: :kill) + payload = JSON.dump(event: :kill) redis.pipelined do |pipeline| batch.ids.each do |id| pipeline.publish("timeline:access_token:#{id}", payload) diff --git a/app/services/activitypub/process_collection_service.rb b/app/services/activitypub/process_collection_service.rb index cadc7d2d10..d9ba5d5822 100644 --- a/app/services/activitypub/process_collection_service.rb +++ b/app/services/activitypub/process_collection_service.rb @@ -6,7 +6,7 @@ class ActivityPub::ProcessCollectionService < BaseService def call(body, actor, **options) @account = actor - @json = original_json = Oj.load(body, mode: :strict) + @json = original_json = JSON.parse(body) @options = options return unless @json.is_a?(Hash) diff --git a/app/services/activitypub/synchronize_followers_service.rb b/app/services/activitypub/synchronize_followers_service.rb index f51d671a00..93a19cee29 100644 --- a/app/services/activitypub/synchronize_followers_service.rb +++ b/app/services/activitypub/synchronize_followers_service.rb @@ -47,7 +47,7 @@ class ActivityPub::SynchronizeFollowersService < BaseService end def build_undo_follow_json(follow) - Oj.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)) + JSON.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)) end def collection_items(collection_or_uri) diff --git a/app/services/after_block_domain_from_account_service.rb b/app/services/after_block_domain_from_account_service.rb index fc5dc65681..d8d1c9cc49 100644 --- a/app/services/after_block_domain_from_account_service.rb +++ b/app/services/after_block_domain_from_account_service.rb @@ -54,7 +54,7 @@ class AfterBlockDomainFromAccountService < BaseService return unless follow.account.activitypub? - ActivityPub::DeliveryWorker.perform_async(Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), @account.id, follow.account.inbox_url) + ActivityPub::DeliveryWorker.perform_async(JSON.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), @account.id, follow.account.inbox_url) end def notify_of_severed_relationships! diff --git a/app/services/authorize_follow_service.rb b/app/services/authorize_follow_service.rb index 49bef727e6..ae91cf9109 100644 --- a/app/services/authorize_follow_service.rb +++ b/app/services/authorize_follow_service.rb @@ -22,6 +22,6 @@ class AuthorizeFollowService < BaseService end def build_json(follow_request) - Oj.dump(serialize_payload(follow_request, ActivityPub::AcceptFollowSerializer)) + JSON.dump(serialize_payload(follow_request, ActivityPub::AcceptFollowSerializer)) end end diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index 133a764873..f6a28ba068 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -21,7 +21,7 @@ class BackupService < BaseService skeleton = serialize(collection_presenter, ActivityPub::CollectionSerializer) skeleton[:@context] = full_context skeleton[:orderedItems] = ['!PLACEHOLDER!'] - skeleton = Oj.dump(skeleton) + skeleton = JSON.dump(skeleton) prepend, append = skeleton.split('"!PLACEHOLDER!"') add_comma = false @@ -41,7 +41,7 @@ class BackupService < BaseService end end - Oj.dump(item) + JSON.dump(item) end.join(',')) GC.start @@ -104,7 +104,7 @@ class BackupService < BaseService download_to_zip(zipfile, account.avatar, "avatar#{File.extname(account.avatar.path)}") if account.avatar.exists? download_to_zip(zipfile, account.header, "header#{File.extname(account.header.path)}") if account.header.exists? - json = Oj.dump(actor) + json = JSON.dump(actor) zipfile.get_output_stream('actor.json') do |io| io.write(json) @@ -115,7 +115,7 @@ class BackupService < BaseService skeleton = serialize(ActivityPub::CollectionPresenter.new(id: 'likes.json', type: :ordered, size: 0, items: []), ActivityPub::CollectionSerializer) skeleton.delete(:totalItems) skeleton[:orderedItems] = ['!PLACEHOLDER!'] - skeleton = Oj.dump(skeleton) + skeleton = JSON.dump(skeleton) prepend, append = skeleton.split('"!PLACEHOLDER!"') zipfile.get_output_stream('likes.json') do |io| @@ -128,7 +128,7 @@ class BackupService < BaseService add_comma = true io.write(statuses.map do |status| - Oj.dump(ActivityPub::TagManager.instance.uri_for(status)) + JSON.dump(ActivityPub::TagManager.instance.uri_for(status)) end.join(',')) GC.start @@ -142,7 +142,7 @@ class BackupService < BaseService skeleton = serialize(ActivityPub::CollectionPresenter.new(id: 'bookmarks.json', type: :ordered, size: 0, items: []), ActivityPub::CollectionSerializer) skeleton.delete(:totalItems) skeleton[:orderedItems] = ['!PLACEHOLDER!'] - skeleton = Oj.dump(skeleton) + skeleton = JSON.dump(skeleton) prepend, append = skeleton.split('"!PLACEHOLDER!"') zipfile.get_output_stream('bookmarks.json') do |io| @@ -154,7 +154,7 @@ class BackupService < BaseService add_comma = true io.write(statuses.map do |status| - Oj.dump(ActivityPub::TagManager.instance.uri_for(status)) + JSON.dump(ActivityPub::TagManager.instance.uri_for(status)) end.join(',')) GC.start diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index de4ee16e91..40e7137dd4 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -82,7 +82,7 @@ class BatchedRemoveStatusService < BaseService def unpush_from_public_timelines(status, pipeline) return unless status.public_visibility? && status.id > @status_id_cutoff - payload = Oj.dump(event: :delete, payload: status.id.to_s) + payload = JSON.dump(event: :delete, payload: status.id.to_s) pipeline.publish('timeline:public', payload) pipeline.publish(status.local? ? 'timeline:public:local' : 'timeline:public:remote', payload) diff --git a/app/services/block_service.rb b/app/services/block_service.rb index 98229d98c0..0bee741f89 100644 --- a/app/services/block_service.rb +++ b/app/services/block_service.rb @@ -26,6 +26,6 @@ class BlockService < BaseService end def build_json(block) - Oj.dump(serialize_payload(block, ActivityPub::BlockSerializer)) + JSON.dump(serialize_payload(block, ActivityPub::BlockSerializer)) end end diff --git a/app/services/create_featured_tag_service.rb b/app/services/create_featured_tag_service.rb index 3cc59156db..99a8cc25aa 100644 --- a/app/services/create_featured_tag_service.rb +++ b/app/services/create_featured_tag_service.rb @@ -20,6 +20,6 @@ class CreateFeaturedTagService < BaseService private def build_json(featured_tag) - Oj.dump(serialize_payload(featured_tag, ActivityPub::AddSerializer, signer: @account)) + JSON.dump(serialize_payload(featured_tag, ActivityPub::AddSerializer, signer: @account)) end end diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 7d06302af5..63bbd20c74 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -114,7 +114,7 @@ class DeleteAccountService < BaseService # we have to force it to unfollow them. ActivityPub::DeliveryWorker.push_bulk(Follow.where(account: @account)) do |follow| - [Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] + [JSON.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] end end @@ -126,7 +126,7 @@ class DeleteAccountService < BaseService # if the remote account gets un-suspended. ActivityPub::DeliveryWorker.push_bulk(Follow.where(target_account: @account)) do |follow| - [Oj.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)), follow.account_id, @account.inbox_url] + [JSON.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)), follow.account_id, @account.inbox_url] end end @@ -285,7 +285,7 @@ class DeleteAccountService < BaseService end def delete_actor_json - @delete_actor_json ||= Oj.dump(serialize_payload(@account, ActivityPub::DeleteActorSerializer, signer: @account, always_sign: true)) + @delete_actor_json ||= JSON.dump(serialize_payload(@account, ActivityPub::DeleteActorSerializer, signer: @account, always_sign: true)) end def delivery_inboxes diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 3c084bc857..71234174bc 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -154,7 +154,7 @@ class FanOutOnWriteService < BaseService end def anonymous_payload - @anonymous_payload ||= Oj.dump( + @anonymous_payload ||= JSON.dump( event: update? ? :'status.update' : :update, payload: rendered_status ) diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb index ded50187f7..6baa1ca460 100644 --- a/app/services/favourite_service.rb +++ b/app/services/favourite_service.rb @@ -42,6 +42,6 @@ class FavouriteService < BaseService end def build_json(favourite) - Oj.dump(serialize_payload(favourite, ActivityPub::LikeSerializer)) + JSON.dump(serialize_payload(favourite, ActivityPub::LikeSerializer)) end end diff --git a/app/services/fetch_oembed_service.rb b/app/services/fetch_oembed_service.rb index c7d4f7e292..c2887e3017 100644 --- a/app/services/fetch_oembed_service.rb +++ b/app/services/fetch_oembed_service.rb @@ -93,7 +93,7 @@ class FetchOEmbedService def parse_for_format(body) case @format when :json - Oj.load(body, mode: :strict)&.with_indifferent_access + JSON.parse(body)&.with_indifferent_access when :xml Ox.load(body, mode: :hash_no_attrs)&.with_indifferent_access&.dig(:oembed) end diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index cff38b8e6e..676f42101a 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -90,7 +90,7 @@ class FollowService < BaseService end def build_json(follow_request) - Oj.dump(serialize_payload(follow_request, ActivityPub::FollowSerializer)) + JSON.dump(serialize_payload(follow_request, ActivityPub::FollowSerializer)) end def follow_options diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index e87e5024fe..a3d2501e9b 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -258,7 +258,7 @@ class NotifyService < BaseService end def push_to_streaming_api! - redis.publish("timeline:#{@recipient.id}:notifications", Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, :notification))) + redis.publish("timeline:#{@recipient.id}:notifications", JSON.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, :notification))) end def subscribed_to_streaming_api? diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index cca79eced6..48cc08e286 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -51,6 +51,6 @@ class ReblogService < BaseService end def build_json(reblog) - Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog), ActivityPub::ActivitySerializer, signer: reblog.account)) + JSON.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog), ActivityPub::ActivitySerializer, signer: reblog.account)) end end diff --git a/app/services/reject_follow_service.rb b/app/services/reject_follow_service.rb index bc0000c8c8..f09cd9ecae 100644 --- a/app/services/reject_follow_service.rb +++ b/app/services/reject_follow_service.rb @@ -17,6 +17,6 @@ class RejectFollowService < BaseService end def build_json(follow_request) - Oj.dump(serialize_payload(follow_request, ActivityPub::RejectFollowSerializer)) + JSON.dump(serialize_payload(follow_request, ActivityPub::RejectFollowSerializer)) end end diff --git a/app/services/remove_domains_from_followers_service.rb b/app/services/remove_domains_from_followers_service.rb index d76763409d..d7384cf50f 100644 --- a/app/services/remove_domains_from_followers_service.rb +++ b/app/services/remove_domains_from_followers_service.rb @@ -18,6 +18,6 @@ class RemoveDomainsFromFollowersService < BaseService end def build_json(follow) - Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) + JSON.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) end end diff --git a/app/services/remove_featured_tag_service.rb b/app/services/remove_featured_tag_service.rb index 2aa70e8fc6..5a1f8f754f 100644 --- a/app/services/remove_featured_tag_service.rb +++ b/app/services/remove_featured_tag_service.rb @@ -13,6 +13,6 @@ class RemoveFeaturedTagService < BaseService private def build_json(featured_tag) - Oj.dump(serialize_payload(featured_tag, ActivityPub::RemoveSerializer, signer: @account)) + JSON.dump(serialize_payload(featured_tag, ActivityPub::RemoveSerializer, signer: @account)) end end diff --git a/app/services/remove_from_followers_service.rb b/app/services/remove_from_followers_service.rb index 007d5b1fdd..32cb6e3d3c 100644 --- a/app/services/remove_from_followers_service.rb +++ b/app/services/remove_from_followers_service.rb @@ -18,6 +18,6 @@ class RemoveFromFollowersService < BaseService end def build_json(follow) - Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) + JSON.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) end end diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index dc9fb6cab6..99cff7fee6 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -14,7 +14,7 @@ class RemoveStatusService < BaseService # @option [Boolean] :original_removed # @option [Boolean] :skip_streaming def call(status, **options) - @payload = Oj.dump(event: :delete, payload: status.id.to_s) + @payload = JSON.dump(event: :delete, payload: status.id.to_s) @status = status @account = status.account @options = options @@ -100,7 +100,7 @@ class RemoveStatusService < BaseService end def signed_activity_json - @signed_activity_json ||= Oj.dump(serialize_payload(@status, @status.reblog? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer, signer: @account, always_sign: true)) + @signed_activity_json ||= JSON.dump(serialize_payload(@status, @status.reblog? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer, signer: @account, always_sign: true)) end def remove_reblogs diff --git a/app/services/report_service.rb b/app/services/report_service.rb index c95e216c79..32e9d79c3f 100644 --- a/app/services/report_service.rb +++ b/app/services/report_service.rb @@ -92,7 +92,7 @@ class ReportService < BaseService end def payload - Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account)) + JSON.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account)) end def some_local_account diff --git a/app/services/software_update_check_service.rb b/app/services/software_update_check_service.rb index 45ec1f50db..e3bc112964 100644 --- a/app/services/software_update_check_service.rb +++ b/app/services/software_update_check_service.rb @@ -20,7 +20,7 @@ class SoftwareUpdateCheckService < BaseService def fetch_update_notices Request.new(:get, "#{api_url}?version=#{version}").add_headers('Accept' => 'application/json', 'User-Agent' => 'Mastodon update checker').perform do |res| - return Oj.load(res.body_with_limit, mode: :strict) if res.code == 200 + return JSON.parse(res.body_with_limit) if res.code == 200 end rescue *Mastodon::HTTP_CONNECTION_ERRORS, Oj::ParseError nil diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 8d5446f1a8..88439a2751 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -33,7 +33,7 @@ class SuspendAccountService < BaseService Follow.where(account: @account).find_in_batches do |follows| ActivityPub::DeliveryWorker.push_bulk(follows) do |follow| - [Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] + [JSON.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] end follows.each(&:destroy) @@ -102,6 +102,6 @@ class SuspendAccountService < BaseService end def signed_activity_json - @signed_activity_json ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account)) + @signed_activity_json ||= JSON.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account)) end end diff --git a/app/services/unblock_service.rb b/app/services/unblock_service.rb index c263ac8afe..c543750410 100644 --- a/app/services/unblock_service.rb +++ b/app/services/unblock_service.rb @@ -18,6 +18,6 @@ class UnblockService < BaseService end def build_json(unblock) - Oj.dump(serialize_payload(unblock, ActivityPub::UndoBlockSerializer)) + JSON.dump(serialize_payload(unblock, ActivityPub::UndoBlockSerializer)) end end diff --git a/app/services/unfavourite_service.rb b/app/services/unfavourite_service.rb index 37917a64f1..d8fec552bc 100644 --- a/app/services/unfavourite_service.rb +++ b/app/services/unfavourite_service.rb @@ -18,6 +18,6 @@ class UnfavouriteService < BaseService end def build_json(favourite) - Oj.dump(serialize_payload(favourite, ActivityPub::UndoLikeSerializer)) + JSON.dump(serialize_payload(favourite, ActivityPub::UndoLikeSerializer)) end end diff --git a/app/services/unfollow_service.rb b/app/services/unfollow_service.rb index b3f2cd66f6..a0d94b22ba 100644 --- a/app/services/unfollow_service.rb +++ b/app/services/unfollow_service.rb @@ -63,10 +63,10 @@ class UnfollowService < BaseService end def build_json(follow) - Oj.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)) + JSON.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)) end def build_reject_json(follow) - Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) + JSON.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) end end diff --git a/app/services/unsuspend_account_service.rb b/app/services/unsuspend_account_service.rb index 652dd6a845..dbe1147c57 100644 --- a/app/services/unsuspend_account_service.rb +++ b/app/services/unsuspend_account_service.rb @@ -98,6 +98,6 @@ class UnsuspendAccountService < BaseService end def signed_activity_json - @signed_activity_json ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account)) + @signed_activity_json ||= JSON.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account)) end end diff --git a/app/services/vote_service.rb b/app/services/vote_service.rb index 878350388b..356ecde6a6 100644 --- a/app/services/vote_service.rb +++ b/app/services/vote_service.rb @@ -65,7 +65,7 @@ class VoteService < BaseService end def build_json(vote) - Oj.dump(serialize_payload(vote, ActivityPub::VoteSerializer)) + JSON.dump(serialize_payload(vote, ActivityPub::VoteSerializer)) end def increment_voters_count! diff --git a/app/services/webhook_service.rb b/app/services/webhook_service.rb index aafa383181..4f964c409d 100644 --- a/app/services/webhook_service.rb +++ b/app/services/webhook_service.rb @@ -17,6 +17,6 @@ class WebhookService < BaseService end def serialize_event - Oj.dump(ActiveModelSerializers::SerializableResource.new(@event, serializer: REST::Admin::WebhookEventSerializer, scope: nil, scope_name: :current_user).as_json) + JSON.dump(ActiveModelSerializers::SerializableResource.new(@event, serializer: REST::Admin::WebhookEventSerializer, scope: nil, scope_name: :current_user).as_json) end end diff --git a/app/validators/reaction_validator.rb b/app/validators/reaction_validator.rb index 89d83de5a2..51e6a01f3c 100644 --- a/app/validators/reaction_validator.rb +++ b/app/validators/reaction_validator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ReactionValidator < ActiveModel::Validator - SUPPORTED_EMOJIS = Oj.load_file(Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_map.json').to_s).keys.freeze + SUPPORTED_EMOJIS = JSON.load_file(Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_map.json').to_s).keys.freeze LIMIT = 8 diff --git a/app/views/shared/_web_app.html.haml b/app/views/shared/_web_app.html.haml index 4f9a20a9f4..fbcfa60da0 100644 --- a/app/views/shared/_web_app.html.haml +++ b/app/views/shared/_web_app.html.haml @@ -11,7 +11,7 @@ = render_initial_state = javascript_pack_tag 'application', crossorigin: 'anonymous' -.notranslate.app-holder#mastodon{ data: { props: Oj.dump(default_props) } } +.notranslate.app-holder#mastodon{ data: { props: JSON.dump(default_props) } } %noscript = image_tag frontend_asset_path('images/logo.svg'), alt: 'Mastodon' diff --git a/app/views/shares/show.html.haml b/app/views/shares/show.html.haml index 1c0bbf6765..f54003c972 100644 --- a/app/views/shares/show.html.haml +++ b/app/views/shares/show.html.haml @@ -2,4 +2,4 @@ = render_initial_state = javascript_pack_tag 'share', crossorigin: 'anonymous' -#mastodon-compose{ data: { props: Oj.dump(default_props) } } +#mastodon-compose{ data: { props: JSON.dump(default_props) } } diff --git a/app/views/statuses/embed.html.haml b/app/views/statuses/embed.html.haml index 09d0792ea2..2dba8ddf50 100644 --- a/app/views/statuses/embed.html.haml +++ b/app/views/statuses/embed.html.haml @@ -1 +1 @@ -#mastodon-status{ data: { props: Oj.dump(default_props.merge(id: @status.id.to_s)) } } +#mastodon-status{ data: { props: JSON.dump(default_props.merge(id: @status.id.to_s)) } } diff --git a/app/workers/activitypub/distribute_poll_update_worker.rb b/app/workers/activitypub/distribute_poll_update_worker.rb index 8c1eefd93d..d28cc060cd 100644 --- a/app/workers/activitypub/distribute_poll_update_worker.rb +++ b/app/workers/activitypub/distribute_poll_update_worker.rb @@ -43,7 +43,7 @@ class ActivityPub::DistributePollUpdateWorker end def payload - @payload ||= Oj.dump(serialize_payload(@status, ActivityPub::UpdatePollSerializer, signer: @account)) + @payload ||= JSON.dump(serialize_payload(@status, ActivityPub::UpdatePollSerializer, signer: @account)) end def relay! diff --git a/app/workers/activitypub/distribution_worker.rb b/app/workers/activitypub/distribution_worker.rb index 575e110257..87876cca93 100644 --- a/app/workers/activitypub/distribution_worker.rb +++ b/app/workers/activitypub/distribution_worker.rb @@ -19,7 +19,7 @@ class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker end def payload - @payload ||= Oj.dump(serialize_payload(activity, ActivityPub::ActivitySerializer, signer: @account)) + @payload ||= JSON.dump(serialize_payload(activity, ActivityPub::ActivitySerializer, signer: @account)) end def activity diff --git a/app/workers/activitypub/move_distribution_worker.rb b/app/workers/activitypub/move_distribution_worker.rb index 1680fcc76e..3eb9839c5e 100644 --- a/app/workers/activitypub/move_distribution_worker.rb +++ b/app/workers/activitypub/move_distribution_worker.rb @@ -28,6 +28,6 @@ class ActivityPub::MoveDistributionWorker end def signed_payload - @signed_payload ||= Oj.dump(serialize_payload(@migration, ActivityPub::MoveSerializer, signer: @account)) + @signed_payload ||= JSON.dump(serialize_payload(@migration, ActivityPub::MoveSerializer, signer: @account)) end end diff --git a/app/workers/activitypub/update_distribution_worker.rb b/app/workers/activitypub/update_distribution_worker.rb index a04ac621f3..89d9c4a5e8 100644 --- a/app/workers/activitypub/update_distribution_worker.rb +++ b/app/workers/activitypub/update_distribution_worker.rb @@ -21,6 +21,6 @@ class ActivityPub::UpdateDistributionWorker < ActivityPub::RawDistributionWorker end def payload - @payload ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account, sign_with: @options[:sign_with])) + @payload ||= JSON.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account, sign_with: @options[:sign_with])) end end diff --git a/app/workers/publish_announcement_reaction_worker.rb b/app/workers/publish_announcement_reaction_worker.rb index 03da56550a..e0317d2275 100644 --- a/app/workers/publish_announcement_reaction_worker.rb +++ b/app/workers/publish_announcement_reaction_worker.rb @@ -11,7 +11,7 @@ class PublishAnnouncementReactionWorker reaction ||= announcement.announcement_reactions.new(name: name) payload = InlineRenderer.render(reaction, nil, :reaction).tap { |h| h[:announcement_id] = announcement_id.to_s } - payload = Oj.dump(event: :'announcement.reaction', payload: payload) + payload = JSON.dump(event: :'announcement.reaction', payload: payload) FeedManager.instance.with_active_accounts do |account| redis.publish("timeline:#{account.id}", payload) if redis.exists?("subscribed:timeline:#{account.id}") diff --git a/app/workers/publish_scheduled_announcement_worker.rb b/app/workers/publish_scheduled_announcement_worker.rb index c23eae6af7..732fd468ab 100644 --- a/app/workers/publish_scheduled_announcement_worker.rb +++ b/app/workers/publish_scheduled_announcement_worker.rb @@ -12,7 +12,7 @@ class PublishScheduledAnnouncementWorker @announcement.publish! unless @announcement.published? payload = InlineRenderer.render(@announcement, nil, :announcement) - payload = Oj.dump(event: :announcement, payload: payload) + payload = JSON.dump(event: :announcement, payload: payload) FeedManager.instance.with_active_accounts do |account| redis.publish("timeline:#{account.id}", payload) if redis.exists?("subscribed:timeline:#{account.id}") diff --git a/app/workers/push_conversation_worker.rb b/app/workers/push_conversation_worker.rb index 23b1469f11..3f27c6e34f 100644 --- a/app/workers/push_conversation_worker.rb +++ b/app/workers/push_conversation_worker.rb @@ -9,7 +9,7 @@ class PushConversationWorker message = InlineRenderer.render(conversation, conversation.account, :conversation) timeline_id = "timeline:direct:#{conversation.account_id}" - redis.publish(timeline_id, Oj.dump(event: :conversation, payload: message)) + redis.publish(timeline_id, JSON.dump(event: :conversation, payload: message)) rescue ActiveRecord::RecordNotFound true end diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index c32975a986..574a9a5a02 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -23,7 +23,7 @@ class PushUpdateWorker end def message - Oj.dump( + JSON.dump( event: update? ? :'status.update' : :update, payload: @payload ) diff --git a/app/workers/scheduler/self_destruct_scheduler.rb b/app/workers/scheduler/self_destruct_scheduler.rb index d0b6ce8a07..544d1811b5 100644 --- a/app/workers/scheduler/self_destruct_scheduler.rb +++ b/app/workers/scheduler/self_destruct_scheduler.rb @@ -60,7 +60,7 @@ class Scheduler::SelfDestructScheduler adapter: ActivityPub::Adapter ).as_json - json = Oj.dump(ActivityPub::LinkedDataSignature.new(payload).sign!(account)) + json = JSON.dump(ActivityPub::LinkedDataSignature.new(payload).sign!(account)) ActivityPub::DeliveryWorker.push_bulk(inboxes, limit: 1_000) do |inbox_url| [json, account.id, inbox_url] diff --git a/app/workers/unfilter_notifications_worker.rb b/app/workers/unfilter_notifications_worker.rb index 53a35ce12c..c1eaa4278a 100644 --- a/app/workers/unfilter_notifications_worker.rb +++ b/app/workers/unfilter_notifications_worker.rb @@ -54,7 +54,7 @@ class UnfilterNotificationsWorker end def push_streaming_event! - redis.publish("timeline:#{@recipient.id}:notifications", Oj.dump(event: :notifications_merged, payload: '1')) + redis.publish("timeline:#{@recipient.id}:notifications", JSON.dump(event: :notifications_merged, payload: '1')) end def subscribed_to_streaming_api? diff --git a/app/workers/unpublish_announcement_worker.rb b/app/workers/unpublish_announcement_worker.rb index e58c07554a..14f3a1ea81 100644 --- a/app/workers/unpublish_announcement_worker.rb +++ b/app/workers/unpublish_announcement_worker.rb @@ -5,7 +5,7 @@ class UnpublishAnnouncementWorker include Redisable def perform(announcement_id) - payload = Oj.dump(event: :'announcement.delete', payload: announcement_id.to_s) + payload = JSON.dump(event: :'announcement.delete', payload: announcement_id.to_s) FeedManager.instance.with_active_accounts do |account| redis.publish("timeline:#{account.id}", payload) if redis.exists?("subscribed:timeline:#{account.id}") diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb index 3629904fa7..78acf0eaab 100644 --- a/app/workers/web/push_notification_worker.rb +++ b/app/workers/web/push_notification_worker.rb @@ -60,7 +60,7 @@ class Web::PushNotificationWorker def push_notification_json I18n.with_locale(@subscription.locale.presence || I18n.default_locale) do - Oj.dump(serialized_notification.as_json) + JSON.dump(serialized_notification.as_json) end end