FIX: Do not downcase group name in current user serializer

FIX: Do not downcase group name in current user serializer

diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb
index 84fed1f..1eafd22 100644
--- a/app/serializers/current_user_serializer.rb
+++ b/app/serializers/current_user_serializer.rb
@@ -52,7 +52,7 @@ class CurrentUserSerializer < BasicUserSerializer
              :skip_new_user_tips
 
   def groups
-    object.visible_groups.pluck(:id, :name).map { |id, name| { id: id, name: name.downcase } }
+    object.visible_groups.pluck(:id, :name).map { |id, name| { id: id, name: name } }
   end
 
   def link_posting_access
diff --git a/spec/serializers/current_user_serializer_spec.rb b/spec/serializers/current_user_serializer_spec.rb
index 9a06bec..0ff5c54 100644
--- a/spec/serializers/current_user_serializer_spec.rb
+++ b/spec/serializers/current_user_serializer_spec.rb
@@ -128,7 +128,7 @@ RSpec.describe CurrentUserSerializer do
     it "should only show visible groups" do
       Fabricate.build(:group, visibility_level: Group.visibility_levels[:public])
       hidden_group = Fabricate.build(:group, visibility_level: Group.visibility_levels[:owners])
-      public_group = Fabricate.build(:group, visibility_level: Group.visibility_levels[:public])
+      public_group = Fabricate.build(:group, visibility_level: Group.visibility_levels[:public], name: "UppercaseGroupName")
       hidden_group.add(member)
       hidden_group.save!
       public_group.add(member)

GitHub sha: 3d39b4bb

I’m curious, why this change? Was there anything broken because of the case of the group’s name?

Yes, I saw some errors in logs, all with groups with uppercase names, and I suspect this is the underlying issue.

1 Like