mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FEATURE: new category setting for whether to show latest topics or top topics by default
This commit is contained in:
@ -6,6 +6,7 @@ class ListController < ApplicationController
|
||||
skip_before_filter :check_xhr
|
||||
|
||||
before_filter :set_category, only: [
|
||||
:category_default,
|
||||
# filtered topics lists
|
||||
Discourse.filters.map { |f| :"category_#{f}" },
|
||||
Discourse.filters.map { |f| :"category_none_#{f}" },
|
||||
@ -29,6 +30,7 @@ class ListController < ApplicationController
|
||||
Discourse.anonymous_filters,
|
||||
Discourse.anonymous_filters.map { |f| "#{f}_feed" },
|
||||
# anonymous categorized filters
|
||||
:category_default,
|
||||
Discourse.anonymous_filters.map { |f| :"category_#{f}" },
|
||||
Discourse.anonymous_filters.map { |f| :"category_none_#{f}" },
|
||||
Discourse.anonymous_filters.map { |f| :"parent_category_category_#{f}" },
|
||||
@ -106,6 +108,14 @@ class ListController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def category_default
|
||||
if @category.default_view == 'top'
|
||||
top(category: @category.id)
|
||||
else
|
||||
self.send(@category.default_view || 'latest')
|
||||
end
|
||||
end
|
||||
|
||||
def topics_by
|
||||
list_opts = build_topic_list_options
|
||||
target_user = fetch_user_from_params({ include_inactive: current_user.try(:staff?) }, [:user_stat, :user_option])
|
||||
|
Reference in New Issue
Block a user