From 2e9562e2fc3eac1d79d562ba74efa86b732cbbcb Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Sat, 23 Jan 2021 21:36:17 -0500 Subject: [PATCH] [home] Reduce following fanout to recent users --- app/models/home_feed.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/home_feed.rb b/app/models/home_feed.rb index 73d5c461..84f95641 100644 --- a/app/models/home_feed.rb +++ b/app/models/home_feed.rb @@ -33,7 +33,13 @@ class HomeFeed < Feed and s.reply is false and ( s.account_id = #{@id} - or s.account_id in (select target_account_id from follows where account_id = #{@id}) + or s.account_id in ( + select ff.target_account_id + from follows ff + join accounts af + on ff.target_account_id = af.id + and af.updated_at > NOW() - INTERVAL '7 days' + where ff.account_id = #{@id}) ) and s.account_id not in (select target_account_id from mutes where account_id = #{@id}) and (reblog.id is null or reblog.account_id not in (select target_account_id from mutes where account_id = #{@id}))