FEATURE: category setting for default list filter.

FEATURE: category setting for default list filter.

diff --git a/app/assets/javascripts/discourse/app/components/edit-category-settings.js b/app/assets/javascripts/discourse/app/components/edit-category-settings.js
index 5844e45..c811ce2 100644
--- a/app/assets/javascripts/discourse/app/components/edit-category-settings.js
+++ b/app/assets/javascripts/discourse/app/components/edit-category-settings.js
@@ -69,6 +69,13 @@ export default buildCategoryPanel("settings", {
   },
 
   @discourseComputed
+  availableListFilters() {
+    return ["all", "none"].map(p => {
+      return { name: I18n.t(`category.list_filters.${p}`), value: p };
+    });
+  },
+
+  @discourseComputed
   searchPrioritiesOptions() {
     const options = [];
 
diff --git a/app/assets/javascripts/discourse/app/models/category.js b/app/assets/javascripts/discourse/app/models/category.js
index 78802cb..eaca16a 100644
--- a/app/assets/javascripts/discourse/app/models/category.js
+++ b/app/assets/javascripts/discourse/app/models/category.js
@@ -187,7 +187,8 @@ const Category = RestModel.extend({
         ),
         search_priority: this.search_priority,
         reviewable_by_group_name: this.reviewable_by_group_name,
-        read_only_banner: this.read_only_banner
+        read_only_banner: this.read_only_banner,
+        default_list_filter: this.default_list_filter
       },
       type: id ? "PUT" : "POST"
     });
diff --git a/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs
index ab17a30..2218fc2 100644
--- a/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs
@@ -196,6 +196,22 @@
       {{/unless}}
     </div>
   </section>
+
+  <section class="field">
+    <label for="category-default-filter">
+      {{i18n "category.default_list_filter"}}
+    </label>
+    <div class="controls">
+      {{combo-box
+        id="category-default-filter"
+        valueProperty="value"
+        content=availableListFilters
+        value=category.default_list_filter
+        none="category.list_filters.all"
+      }}
+    </div>
+  </section>
+
   {{#if isParentCategory}}
     <section class="field show-subcategory-list-field">
       <label>
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index 770275a..8fc6ad7 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -329,6 +329,7 @@ class CategoriesController < ApplicationController
         :required_tag_group_name,
         :min_tags_from_required_group,
         :read_only_banner,
+        :default_list_filter,
         custom_fields: [params[:custom_fields].try(:keys)],
         permissions: [*p.try(:keys)],
         allowed_tags: [],
diff --git a/db/migrate/20200524181959_add_default_list_filter_to_categories.rb b/db/migrate/20200524181959_add_default_list_filter_to_categories.rb
new file mode 100644
index 0000000..4c43b5c
--- /dev/null
+++ b/db/migrate/20200524181959_add_default_list_filter_to_categories.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDefaultListFilterToCategories < ActiveRecord::Migration[6.0]
+  def change
+    add_column :categories, :default_list_filter, :string, limit: 20, default: 'all'
+  end
+end

GitHub sha: 6f03d14c

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/new-non-functional-in-category-settings-page/153270/3