[home] refactor the home timeline query
This commit is contained in:
parent
59b1752797
commit
d39664b827
|
@ -28,18 +28,15 @@ class HomeFeed < Feed
|
||||||
from statuses s
|
from statuses s
|
||||||
left join statuses reblog
|
left join statuses reblog
|
||||||
on s.reblog_of_id = reblog.id
|
on s.reblog_of_id = reblog.id
|
||||||
|
left join follows f
|
||||||
|
on s.account_id = f.target_account_id
|
||||||
|
and f.account_id = #{@id}
|
||||||
where
|
where
|
||||||
s.created_at > NOW() - INTERVAL '7 days'
|
s.created_at > NOW() - INTERVAL '7 days'
|
||||||
and s.reply is false
|
and s.reply is false
|
||||||
and (
|
and (
|
||||||
s.account_id = #{@id}
|
s.account_id = #{@id}
|
||||||
or s.account_id in (
|
or f.id is not null
|
||||||
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 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}))
|
and (reblog.id is null or reblog.account_id not in (select target_account_id from mutes where account_id = #{@id}))
|
||||||
|
@ -58,8 +55,5 @@ class HomeFeed < Feed
|
||||||
# or rb.text like '%' || cf.phrase || '%')
|
# or rb.text like '%' || cf.phrase || '%')
|
||||||
# where cf.id is null or st.account_id = #{@id}
|
# where cf.id is null or st.account_id = #{@id}
|
||||||
#"
|
#"
|
||||||
# .reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
|
|
||||||
# Status.as_home_timeline(@account)
|
|
||||||
# .paginate_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue