Optimize MuteService and AfterBlockService (#2836)
This commit is contained in:
parent
496f466d73
commit
59804abc3d
5 changed files with 70 additions and 31 deletions
|
@ -3,21 +3,7 @@
|
|||
class MuteService < BaseService
|
||||
def call(account, target_account)
|
||||
return if account.id == target_account.id
|
||||
clear_home_timeline(account, target_account)
|
||||
FeedManager.instance.clear_from_timeline(account, target_account)
|
||||
account.mute!(target_account)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def clear_home_timeline(account, target_account)
|
||||
home_key = FeedManager.instance.key(:home, account.id)
|
||||
|
||||
target_account.statuses.select('id').reorder(nil).find_each do |status|
|
||||
redis.zrem(home_key, status.id)
|
||||
end
|
||||
end
|
||||
|
||||
def redis
|
||||
Redis.current
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue