1
0
Fork 0
forked from gitea/nas
nas/app/workers/delivery_emoji_reaction_worker.rb
2023-05-31 19:49:17 +09:00

22 lines
636 B
Ruby

# frozen_string_literal: true
class DeliveryEmojiReactionWorker
include Sidekiq::Worker
include Redisable
include Lockable
include AccountScope
def perform(payload_json, status_id, _my_account_id = nil)
status = Status.find(status_id.to_i)
if status.present?
scope_status(status).includes(:user).find_each do |account|
redis.publish("timeline:#{account.id}", payload_json) if (!account.respond_to?(:user) || !account.user&.setting_stop_emoji_reaction_streaming) && redis.exists?("subscribed:timeline:#{account.id}")
end
end
true
rescue ActiveRecord::RecordNotFound
true
end
end