0
0
Fork 0

Optimize MuteService and AfterBlockService (#2836)

This commit is contained in:
alpaca-tc 2017-05-06 23:31:07 +09:00 committed by Eugen Rochko
parent 496f466d73
commit 59804abc3d
5 changed files with 70 additions and 31 deletions

View file

@ -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