2018-10-07 14:44:58 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class MuteWorker
|
|
|
|
include Sidekiq::Worker
|
2024-07-09 10:30:38 -07:00
|
|
|
include Redisable
|
2018-10-07 14:44:58 -07:00
|
|
|
|
|
|
|
def perform(account_id, target_account_id)
|
2024-07-09 10:30:38 -07:00
|
|
|
@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
|
2018-10-07 14:44:58 -07:00
|
|
|
end
|
2024-07-09 10:30:38 -07:00
|
|
|
|
|
|
|
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
|
2018-10-07 14:44:58 -07:00
|
|
|
end
|