mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:01:04 +08:00
DEV: Switch over category settings to new table - Part 3 (#20657)
In #20135 we prevented invalid inputs from being accepted in category setting form fields on the front-end. We didn't do anything on the back-end at that time, because we were still discussing which path we wanted to take. Eventually we decided we want to move this to a new CategorySetting model. This PR moves the require_topic_approval and require_reply_approval from custom fields to the new CategorySetting model. This PR is nearly identical to #20580, which migrated num_auto_bump_daily, but since these are slightly more sensitive, they are moved after the previous one is verified.
This commit is contained in:
@ -714,8 +714,8 @@ RSpec.describe CategoriesController do
|
||||
end
|
||||
|
||||
it "updates per-category settings correctly" do
|
||||
category.custom_fields[Category::REQUIRE_TOPIC_APPROVAL] = false
|
||||
category.custom_fields[Category::REQUIRE_REPLY_APPROVAL] = false
|
||||
category.require_topic_approval = false
|
||||
category.require_reply_approval = false
|
||||
|
||||
category.navigate_to_first_post_after_read = false
|
||||
category.save!
|
||||
@ -726,11 +726,9 @@ RSpec.describe CategoriesController do
|
||||
color: category.color,
|
||||
text_color: category.text_color,
|
||||
navigate_to_first_post_after_read: true,
|
||||
custom_fields: {
|
||||
category_setting_attributes: {
|
||||
require_reply_approval: true,
|
||||
require_topic_approval: true,
|
||||
},
|
||||
category_setting_attributes: {
|
||||
num_auto_bump_daily: 10,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user