FEATURE: remove support for 'suppress_from_latest' category setting. (#8308)

This commit is contained in:
Vinoth Kannan
2019-11-18 12:28:35 +05:30
committed by GitHub
parent 4e4844f4db
commit 3bb7ad4be1
20 changed files with 64 additions and 182 deletions

View File

@ -47,8 +47,7 @@ class CategoriesController < ApplicationController
style = SiteSetting.desktop_category_page_style
topic_options = {
per_page: SiteSetting.categories_topics,
no_definitions: true,
exclude_category_ids: Category.where(suppress_from_latest: true).pluck(:id)
no_definitions: true
}
if style == "categories_and_latest_topics".freeze
@ -238,8 +237,7 @@ class CategoriesController < ApplicationController
topic_options = {
per_page: SiteSetting.categories_topics,
no_definitions: true,
exclude_category_ids: Category.where(suppress_from_latest: true).pluck(:id)
no_definitions: true
}
result = CategoryAndTopicLists.new
@ -291,7 +289,6 @@ class CategoriesController < ApplicationController
:email_in,
:email_in_allow_strangers,
:mailinglist_mirror,
:suppress_from_latest,
:all_topics_wiki,
:parent_category_id,
:auto_close_hours,

View File

@ -52,15 +52,7 @@ class ListController < ApplicationController
list_opts = build_topic_list_options
list_opts.merge!(options) if options
user = list_target_user
if params[:category].blank?
if filter == :latest
list_opts[:no_definitions] = true
end
if [:latest, :categories].include?(filter) && list_opts[:exclude_category_ids].blank?
list_opts[:exclude_category_ids] = get_excluded_category_ids(list_opts[:category])
end
end
list_opts[:no_definitions] = true if params[:category].blank? && filter == :latest
list = TopicQuery.new(user, list_opts).public_send("list_#{filter}")
@ -246,10 +238,6 @@ class ListController < ApplicationController
top_options.merge!(options) if options
top_options[:per_page] = SiteSetting.topics_per_period_in_top_page
if "top".freeze == current_homepage && top_options[:exclude_category_ids].blank?
top_options[:exclude_category_ids] = get_excluded_category_ids(top_options[:category])
end
user = list_target_user
list = TopicQuery.new(user, top_options).list_top_for(period)
list.for_period = period
@ -393,12 +381,6 @@ class ListController < ApplicationController
public_send(method, opts.merge(page_params)).sub('.json?', '?')
end
def get_excluded_category_ids(current_category = nil)
exclude_category_ids = Category.where(suppress_from_latest: true)
exclude_category_ids = exclude_category_ids.where.not(id: current_category) if current_category
exclude_category_ids.pluck(:id)
end
def self.best_period_for(previous_visit_at, category_id = nil)
default_period = ((category_id && Category.where(id: category_id).pluck_first(:default_top_period)) ||
SiteSetting.top_page_default_timeframe).to_sym

View File

@ -392,7 +392,6 @@ class TagsController < ::ApplicationController
options = super.merge(
page: params[:page],
topic_ids: param_to_integer_list(:topic_ids),
exclude_category_ids: params[:exclude_category_ids],
category: @filter_on_category ? @filter_on_category.id : params[:category],
order: params[:order],
ascending: params[:ascending],