diff --git a/app/assets/javascripts/discourse/app/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/app/components/edit-category-settings.hbs index 2a36e0531d..cd027fcb60 100644 --- a/app/assets/javascripts/discourse/app/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/app/components/edit-category-settings.hbs @@ -187,7 +187,7 @@ {{i18n "category.num_auto_bump_daily"}} 0') - .select(:category_id) - - Category.where(id: auto_bumps).shuffle.any? { |c| c.auto_bump_topic! } + Category + .joins(:category_setting) + .where("category_settings.num_auto_bump_daily > 0") + .shuffle + .any? { |c| c.auto_bump_topic! } end # will automatically bump a single topic diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb index 3157f3e4db..48515c50db 100644 --- a/spec/models/category_spec.rb +++ b/spec/models/category_spec.rb @@ -974,10 +974,10 @@ RSpec.describe Category do category = Fabricate( :category_with_definition, - num_auto_bump_daily: 2, created_at: 1.minute.ago, category_setting_attributes: { auto_bump_cooldown_days: 1, + num_auto_bump_daily: 2, }, ) category.clear_auto_bump_cache! diff --git a/spec/requests/categories_controller_spec.rb b/spec/requests/categories_controller_spec.rb index 863ad47be4..fdcbb19f34 100644 --- a/spec/requests/categories_controller_spec.rb +++ b/spec/requests/categories_controller_spec.rb @@ -743,7 +743,6 @@ RSpec.describe CategoriesController do it "updates per-category settings correctly" do category.custom_fields[Category::REQUIRE_TOPIC_APPROVAL] = false category.custom_fields[Category::REQUIRE_REPLY_APPROVAL] = false - category.custom_fields[Category::NUM_AUTO_BUMP_DAILY] = 0 category.navigate_to_first_post_after_read = false category.save! @@ -757,6 +756,8 @@ RSpec.describe CategoriesController do custom_fields: { require_reply_approval: true, require_topic_approval: true, + }, + category_setting_attributes: { num_auto_bump_daily: 10, }, }