fix(backend): only validate member name if it's changed

This commit is contained in:
sam 2024-09-30 20:14:16 +02:00
parent 2b8e4c3e8d
commit 8f3478d57a
Signed by: sam
GPG key ID: B4EF20DDE721CAA1

View file

@ -100,7 +100,9 @@ public class MembersController(
var member = await db.ResolveMemberAsync(CurrentUser!.Id, memberRef);
var errors = new List<(string, ValidationError?)>();
if (req.Name != null)
// We might add extra validations for names later down the line.
// These should only take effect when a member's name is changed, not on other changes.
if (req.Name != null && req.Name != member.Name)
{
errors.Add(("name", ValidationUtils.ValidateMemberName(req.Name)));
member.Name = req.Name;