mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: ensure GroupChooser works with localized group names (#30593)
The "Tag Groups Form" component was using group names to handle permissions. This works just fine when the default locale is "English" but breaks as soon as it's changed to a different locale. The fix is to use the group id's for handling the permissions instead of the group name. Reported in https://meta.discourse.org/t/221849
This commit is contained in:
@@ -13,7 +13,7 @@ RSpec.describe TagGroupSerializer do
|
||||
|
||||
serialized = TagGroupSerializer.new(tag_group, root: false).as_json
|
||||
|
||||
expect(serialized[:permissions].keys).to contain_exactly("staff")
|
||||
expect(serialized[:permissions].keys).to contain_exactly(Group::AUTO_GROUPS[:staff])
|
||||
end
|
||||
|
||||
it "doesn't return tag synonyms" do
|
||||
@@ -21,6 +21,6 @@ RSpec.describe TagGroupSerializer do
|
||||
synonym = Fabricate(:tag, target_tag: tag)
|
||||
tag_group = Fabricate(:tag_group, tags: [tag, synonym])
|
||||
serialized = TagGroupSerializer.new(tag_group, root: false).as_json
|
||||
expect(serialized[:tag_names]).to eq([tag.name])
|
||||
expect(serialized[:tag_names]).to contain_exactly(tag.name)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user