diff --git a/app/controllers/api/v1/timelines/explore_controller.rb b/app/controllers/api/v1/timelines/explore_controller.rb index fcf69c9a..52af419d 100644 --- a/app/controllers/api/v1/timelines/explore_controller.rb +++ b/app/controllers/api/v1/timelines/explore_controller.rb @@ -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 diff --git a/app/lib/sorting_query_builder.rb b/app/lib/sorting_query_builder.rb index d2927437..8988bf6d 100644 --- a/app/lib/sorting_query_builder.rb +++ b/app/lib/sorting_query_builder.rb @@ -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)