authorize @status, :destroy?
@status.discard
- RemovalWorker.perform_async(@status.id, redraft: true)
+ RemovalWorker.perform_async(@status.id, { 'redraft' => true })
@status.account.statuses_count = @status.account.statuses_count - 1
render json: @status, serializer: REST::StatusSerializer, source_requested: true
LinkCrawlWorker.perform_in(rand(1..59).seconds, @status.id)
# Distribute into home and list feeds and notify mentioned accounts
- ::DistributionWorker.perform_async(@status.id, silenced_account_ids: @silenced_account_ids) if @options[:override_timestamps] || @status.within_realtime_window?
+ ::DistributionWorker.perform_async(@status.id, { 'silenced_account_ids' => @silenced_account_ids }) if @options[:override_timestamps] || @status.within_realtime_window?
end
def find_existing_status
return unless delivered_to_account.following?(@account)
- FeedInsertWorker.perform_async(@status.id, delivered_to_account.id, :home)
+ FeedInsertWorker.perform_async(@status.id, delivered_to_account.id, 'home')
end
def delivered_to_account
return false unless add_to_feed(:home, account.id, status, account.user&.aggregates_reblogs?)
trim(:home, account.id)
- PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}", update: update) if push_update_required?("timeline:#{account.id}")
+ PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}", { 'update' => update }) if push_update_required?("timeline:#{account.id}")
true
end
return false if filter_from_list?(status, list) || !add_to_feed(:list, list.id, status, list.account.user&.aggregates_reblogs?)
trim(:list, list.id)
- PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}", update: update) if push_update_required?("timeline:list:#{list.id}")
+ PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}", { 'update' => update }) if push_update_required?("timeline:list:#{list.id}")
true
end
end
UserMailer.warning(target_account.user, @warning).deliver_later! if target_account.local?
- RemovalWorker.push_bulk(status_ids) { |status_id| [status_id, preserve: target_account.local?, immediate: !target_account.local?] }
+ RemovalWorker.push_bulk(status_ids) { |status_id| [status_id, { 'preserve' => target_account.local?, 'immediate' => !target_account.local? }] }
end
def handle_report!
authorize(account.user, :reject?)
log_action(:reject, account.user, username: account.username)
account.suspend!(origin: :local)
- AccountDeletionWorker.perform_async(account.id, reserve_username: false)
+ AccountDeletionWorker.perform_async(account.id, { 'reserve_username' => false })
end
def suspend_account(account)
account_policy.statuses_to_delete(budget, cutoff_id, account_policy.last_inspected).reorder(nil).find_each(order: :asc) do |status|
status.discard
- RemovalWorker.perform_async(status.id, redraft: false)
+ RemovalWorker.perform_async(status.id, { 'redraft' => false })
num_deleted += 1
last_deleted = status.id
end
end
def broadcast_updates!
- ::DistributionWorker.perform_async(@status.id, update: true)
+ ::DistributionWorker.perform_async(@status.id, { 'update' => true })
end
def queue_poll_notifications!
def notify_mentioned_accounts!
@status.active_mentions.where.not(id: @options[:silenced_account_ids] || []).joins(:account).merge(Account.local).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
LocalNotificationWorker.push_bulk(mentions) do |mention|
- [mention.account_id, mention.id, 'Mention', :mention]
+ [mention.account_id, mention.id, 'Mention', 'mention']
end
end
end
def deliver_to_all_followers!
@account.followers_for_local_distribution.select(:id).reorder(nil).find_in_batches do |followers|
FeedInsertWorker.push_bulk(followers) do |follower|
- [@status.id, follower.id, :home, update: update?]
+ [@status.id, follower.id, 'home', { 'update' => update? }]
end
end
end
def deliver_to_lists!
@account.lists_for_local_distribution.select(:id).reorder(nil).find_in_batches do |lists|
FeedInsertWorker.push_bulk(lists) do |list|
- [@status.id, list.id, :list, update: update?]
+ [@status.id, list.id, 'list', { 'update' => update? }]
end
end
end
def deliver_to_mentioned_followers!
@status.mentions.joins(:account).merge(@account.followers_for_local_distribution).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
FeedInsertWorker.push_bulk(mentions) do |mention|
- [@status.id, mention.account_id, :home, update: update?]
+ [@status.id, mention.account_id, 'home', { 'update' => update? }]
end
end
end
follow_request = @source_account.request_follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit], bypass_limit: @options[:bypass_limit])
if @target_account.local?
- LocalNotificationWorker.perform_async(@target_account.id, follow_request.id, follow_request.class.name, :follow_request)
+ LocalNotificationWorker.perform_async(@target_account.id, follow_request.id, follow_request.class.name, 'follow_request')
elsif @target_account.activitypub?
ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), @source_account.id, @target_account.inbox_url)
end
def direct_follow!
follow = @source_account.follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit], bypass_limit: @options[:bypass_limit])
- LocalNotificationWorker.perform_async(@target_account.id, follow.id, follow.class.name, :follow)
+ LocalNotificationWorker.perform_async(@target_account.id, follow.id, follow.class.name, 'follow')
MergeWorker.perform_async(@target_account.id, @source_account.id)
follow
if presence_hash[target_account.acct]
items.delete(target_account.acct)
extra = presence_hash[target_account.acct][1]
- Import::RelationshipWorker.perform_async(@account.id, target_account.acct, action, extra)
+ Import::RelationshipWorker.perform_async(@account.id, target_account.acct, action, extra.stringify_keys)
else
Import::RelationshipWorker.perform_async(@account.id, target_account.acct, undo_action)
end
tail_items = items - head_items
Import::RelationshipWorker.push_bulk(head_items + tail_items) do |acct, extra|
- [@account.id, acct, action, extra]
+ [@account.id, acct, action, extra.stringify_keys]
end
end
reblogged_status = reblog.reblog
if reblogged_status.account.local?
- LocalNotificationWorker.perform_async(reblogged_status.account_id, reblog.id, reblog.class.name, :reblog)
+ LocalNotificationWorker.perform_async(reblogged_status.account_id, reblog.id, reblog.class.name, 'reblog')
elsif reblogged_status.account.activitypub? && !reblogged_status.account.following?(reblog.account)
ActivityPub::DeliveryWorker.perform_async(build_json(reblog), reblog.account_id, reblogged_status.account.inbox_url)
end
def queue_deletion!
@account.suspend!(origin: :remote)
- AccountDeletionWorker.perform_async(@account.id, reserve_username: false, skip_activitypub: true)
+ AccountDeletionWorker.perform_async(@account.id, { 'reserve_username' => false, 'skip_activitypub' => true })
end
def lock_options
end
def options
- { synchronize_followers: @status.private_visibility? }
+ { 'synchronize_followers' => @status.private_visibility? }
end
end
class FeedInsertWorker
include Sidekiq::Worker
- def perform(status_id, id, type = :home, options = {})
+ def perform(status_id, id, type = 'home', options = {})
@type = type.to_sym
@status = Status.find(status_id)
@options = options.symbolize_keys
def clean_discarded_statuses!
Status.discarded.where('deleted_at <= ?', 30.days.ago).find_in_batches do |statuses|
RemovalWorker.push_bulk(statuses) do |status|
- [status.id, { immediate: true }]
+ [status.id, { 'immediate' => true }]
end
end
end
env: { email: 'pam@example.com' }
}
end
+
+# Catch serialization warnings early
+Sidekiq.strict_args!