[explore] Remove group posts from explore page.

This commit is contained in:
Fosco Marotto 2021-01-25 02:35:10 -05:00
parent 4adbadddaa
commit 81489b7a17
2 changed files with 12 additions and 4 deletions

View File

@ -44,12 +44,12 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
def explore_statuses
if current_account
SortingQueryBuilder.new.call(@sort_type, nil, params[:page]).reject {|status|
SortingQueryBuilder.new.call(@sort_type, nil, params[:page], nil, "explore").reject {|status|
FeedManager.instance.filter?(:home, status, current_account.id)
}
else
page = [params[:page].to_i.abs, MIN_UNAUTHENTICATED_PAGES].min
SortingQueryBuilder.new.call(@sort_type, nil, page)
SortingQueryBuilder.new.call(@sort_type, nil, page, nil, "explore")
end
end

View File

@ -91,7 +91,11 @@ class SortingQueryBuilder < BaseService
query = Status.without_replies.without_reblogs
query = query.with_public_visibility if group.nil?
query = query.where('statuses.created_at > ?', date_limit)
query = query.where(group: group) unless group.nil?
if source == "explore"
query = query.where(group: nil)
else
query = query.where(group: group) unless group.nil?
end
query = query.page(page.to_i)
query = query.per(limit)
return query
@ -105,7 +109,11 @@ class SortingQueryBuilder < BaseService
query = query.joins(:status)
query = query.where('statuses.reblog_of_id IS NULL')
query = query.where('statuses.in_reply_to_id IS NULL')
query = query.where('statuses.group_id': group) unless group.nil?
if source == "explore"
query = query.where('statuses.group_id': nil)
else
query = query.where('statuses.group_id': group) unless group.nil?
end
query = query.where('statuses.visibility': 0) if group.nil?
query = query.page(page)
query = query.per(limit)