fix(bot): respect character limit for group display names

This commit is contained in:
Petal Ladenson 2024-10-04 04:55:46 -06:00 committed by GitHub
parent 9f50e055f6
commit f37a6f4290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -191,6 +191,8 @@ public class Groups
else
{
var newDisplayName = ctx.RemainderOrNull(false).NormalizeLineEndSpacing();
if (newDisplayName.Length > Limits.MaxGroupNameLength)
throw new PKError($"Group name too long ({newDisplayName.Length}/{Limits.MaxGroupNameLength} characters).");
var patch = new GroupPatch { DisplayName = Partial<string>.Present(newDisplayName) };
await ctx.Repository.UpdateGroup(target.Id, patch);