Skip to content

A platform for community discussion. Free, open, simple.

UX: set categories_topics to 0 by default for automatic calculation (#37110)

Kris348608481208
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 3f199be61af..07f6fdc7c5f 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2098,7 +2098,7 @@ en:
alert_admins_if_errors_per_minute: "Number of errors per minute in order to trigger an admin alert. A value of 0 disables this feature. NOTE: requires restart."
alert_admins_if_errors_per_hour: "Number of errors per hour in order to trigger an admin alert. A value of 0 disables this feature. NOTE: requires restart."
- categories_topics: "Number of topics to show in /categories page. If set to 0, it will automatically try to find a value to keep the two columns symmetrical (categories and topics)."
+ categories_topics: 'Number of topics to show on the /categories page. If set to 0, it will automatically set a value to keep the two columns symmetrical. Only relevant for "categories and latest/top topics" <a href="%{base_path}/admin/site_settings/category/all_results?filter=category style">category page styles</a>.'
suggested_topics: "Number of suggested topics shown at the bottom of a topic."
limit_suggested_to_category: "Only show topics from the current category in suggested topics."
suggested_topics_max_days_old: "Suggested topics should not be more than n days old."
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 54f31230c60..0ddf63b0573 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -202,7 +202,7 @@ basic:
default: false
area: "localization"
categories_topics:
- default: 20
+ default: 0
validator: "CategoriesTopicsValidator"
area: "interface"
suggested_topics:
diff --git a/spec/requests/categories_controller_spec.rb b/spec/requests/categories_controller_spec.rb
index e02e2a351b5..9e38743fd19 100644
--- a/spec/requests/categories_controller_spec.rb
+++ b/spec/requests/categories_controller_spec.rb
@@ -1278,6 +1278,7 @@ RSpec.describe CategoriesController do
describe "Showing top topics from private categories" do
it "returns the top topic from the private category when the user is a member" do
+ SiteSetting.categories_topics = 5
restricted_group = Fabricate(:group)
private_cat = Fabricate(:private_category, group: restricted_group)
private_topic = Fabricate(:topic, category: private_cat, like_count: 1000, posts_count: 100)
@@ -1298,10 +1299,11 @@ RSpec.describe CategoriesController do
describe "Showing hot topics from private categories" do
it "returns the hot topic from the private category when the user is a member" do
+ SiteSetting.categories_topics = 5
restricted_group = Fabricate(:group)
private_cat = Fabricate(:private_category, group: restricted_group)
private_topic = Fabricate(:topic, category: private_cat, like_count: 1000, posts_count: 100)
- TopicHotScore.update_scores
+ TopicHotScore.create!(topic_id: private_topic.id, score: 1.0)
restricted_group.add(user)
sign_in(user)