mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:51:07 +08:00
FEATURE: remove support for 'suppress_from_latest' category setting. (#8308)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user