fix(bot): apply display name length checks when setting

This commit is contained in:
spiral 2022-09-22 18:11:27 +00:00
parent a2b38c45e2
commit 897fad12e6
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E

View File

@ -423,6 +423,9 @@ public class MemberEdit
{
var newDisplayName = ctx.RemainderOrNull(false).NormalizeLineEndSpacing();
if (newDisplayName.Length > Limits.MaxMemberNameLength)
throw Errors.StringTooLongError("Member display name", newDisplayName.Length, Limits.MaxMemberNameLength);
var patch = new MemberPatch { DisplayName = Partial<string>.Present(newDisplayName) };
await ctx.Repository.UpdateMember(target.Id, patch);