mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: Allow multiple required tag groups for a category (#16381)
Previously we only supported a single 'required tag group' for a category. This commit allows admins to specify multiple required tag groups, each with their own minimum tag count. A new category_required_tag_groups database table replaces the existing columns on the categories table. Data is automatically migrated.
This commit is contained in:
@ -577,7 +577,7 @@ describe NewPostManager do
|
||||
let(:tag) { Fabricate(:tag) }
|
||||
before do
|
||||
TagGroupMembership.create(tag: tag, tag_group: tag_group)
|
||||
category.update(min_tags_from_required_group: 1, required_tag_group_id: tag_group.id)
|
||||
category.update(category_required_tag_groups: [CategoryRequiredTagGroup.new(tag_group: tag_group, min_count: 1)])
|
||||
end
|
||||
|
||||
it "errors when there are no tags from the group provided" do
|
||||
@ -593,8 +593,8 @@ describe NewPostManager do
|
||||
expect(result.errors.full_messages).to include(
|
||||
I18n.t(
|
||||
"tags.required_tags_from_group",
|
||||
count: category.min_tags_from_required_group,
|
||||
tag_group_name: category.required_tag_group.name,
|
||||
count: category.category_required_tag_groups.first.min_count,
|
||||
tag_group_name: category.category_required_tag_groups.first.tag_group.name,
|
||||
tags: tag.name
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user