1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/app/workers/mute_worker.rb

27 lines
600 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class MuteWorker
include Sidekiq::Worker
include Redisable
def perform(account_id, target_account_id)
@account = Account.find(account_id)
@target_account = Account.find(target_account_id)
clear_home_feed!
notify_streaming!
2020-09-07 18:41:16 -07:00
rescue ActiveRecord::RecordNotFound
true
end
private
def clear_home_feed!
FeedManager.instance.clear_from_home(@account, @target_account)
end
def notify_streaming!
redis.publish('system', Oj.dump(event: :mutes_changed, account: @account.id, target_account: @target_account.id))
end
end