From 91c1b769c389c1ef17942013b8a3cb831703b981 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Thu, 24 Dec 2020 13:41:00 -0500 Subject: [PATCH] Fixed issues with ExploreController, SortingQueryBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed: - issues with ExploreController when no account exists - SortingQueryBuilder with correct status_stat path --- app/controllers/api/v1/timelines/explore_controller.rb | 2 +- app/lib/sorting_query_builder.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/timelines/explore_controller.rb b/app/controllers/api/v1/timelines/explore_controller.rb index eb5665f4..af63c298 100644 --- a/app/controllers/api/v1/timelines/explore_controller.rb +++ b/app/controllers/api/v1/timelines/explore_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Timelines::ExploreController < EmptyController +class Api::V1::Timelines::ExploreController < Api::BaseController before_action :set_sort_type before_action :set_statuses diff --git a/app/lib/sorting_query_builder.rb b/app/lib/sorting_query_builder.rb index 46e8505f..ed5b5a7d 100644 --- a/app/lib/sorting_query_builder.rb +++ b/app/lib/sorting_query_builder.rb @@ -51,9 +51,9 @@ class SortingQueryBuilder < BaseService query = StatusStat.where('status_stats.created_at > ?', date_limit) query = query.order(top_order) unless sort_type == 'recent' query = query.order(updated_at: :desc) if sort_type == 'recent' - query = query.where('status.stats.replies_count > ?', min_replies) unless sort_type == 'recent' - query = query.where('status.stats.reblogs_count > ?', min_reblogs) unless sort_type == 'recent' - query = query.where('status.stats.favourites_count > ?', min_likes) unless sort_type == 'recent' + query = query.where('status_stats.replies_count > ?', min_replies) unless sort_type == 'recent' + query = query.where('status_stats.reblogs_count > ?', min_reblogs) unless sort_type == 'recent' + query = query.where('status_stats.favourites_count > ?', min_likes) unless sort_type == 'recent' query = query.joins(:status) query = query.where('statuses.reblog_of_id IS NULL') query = query.where('statuses.in_reply_to_id IS NULL')