Add display name editing
- Set display name during member POST - Update display name during member PATCH
This commit is contained in:
parent
1cfeaf281b
commit
d38c38cb9e
@ -41,6 +41,8 @@ namespace PluralKit.API.Controllers
|
||||
// Explicit bounds checks
|
||||
if (newMember.Name != null && newMember.Name.Length > Limits.MaxMemberNameLength)
|
||||
return BadRequest($"Member name too long ({newMember.Name.Length} > {Limits.MaxMemberNameLength}.");
|
||||
if (newMember.DisplayName != null && newMember.DisplayName.Length > Limits.MaxMemberNameLength)
|
||||
return BadRequest($"Member display name too long ({newMember.DisplayName.Length} > {Limits.MaxMemberNameLength}.");
|
||||
if (newMember.Pronouns != null && newMember.Pronouns.Length > Limits.MaxPronounsLength)
|
||||
return BadRequest($"Member pronouns too long ({newMember.Pronouns.Length} > {Limits.MaxPronounsLength}.");
|
||||
if (newMember.Description != null && newMember.Description.Length > Limits.MaxDescriptionLength)
|
||||
@ -57,6 +59,7 @@ namespace PluralKit.API.Controllers
|
||||
var member = await _members.Create(system, newMember.Name);
|
||||
|
||||
member.Name = newMember.Name;
|
||||
member.DisplayName = newMember.DisplayName;
|
||||
member.Color = newMember.Color;
|
||||
member.AvatarUrl = newMember.AvatarUrl;
|
||||
member.Birthday = newMember.Birthday;
|
||||
@ -84,6 +87,8 @@ namespace PluralKit.API.Controllers
|
||||
// Explicit bounds checks
|
||||
if (newMember.Name != null && newMember.Name.Length > Limits.MaxMemberNameLength)
|
||||
return BadRequest($"Member name too long ({newMember.Name.Length} > {Limits.MaxMemberNameLength}.");
|
||||
if (newMember.DisplayName != null && newMember.DisplayName.Length > Limits.MaxMemberNameLength)
|
||||
return BadRequest($"Member display name too long ({newMember.DisplayName.Length} > {Limits.MaxMemberNameLength}.");
|
||||
if (newMember.Pronouns != null && newMember.Pronouns.Length > Limits.MaxPronounsLength)
|
||||
return BadRequest($"Member pronouns too long ({newMember.Pronouns.Length} > {Limits.MaxPronounsLength}.");
|
||||
if (newMember.Description != null && newMember.Description.Length > Limits.MaxDescriptionLength)
|
||||
@ -98,6 +103,7 @@ namespace PluralKit.API.Controllers
|
||||
return BadRequest();
|
||||
|
||||
member.Name = newMember.Name;
|
||||
member.DisplayName = newMember.DisplayName;
|
||||
member.Color = newMember.Color;
|
||||
member.AvatarUrl = newMember.AvatarUrl;
|
||||
member.Birthday = newMember.Birthday;
|
||||
|
Loading…
Reference in New Issue
Block a user