From 8f3478d57a9624d1719889b1e2a2c311a0a78e9a Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 30 Sep 2024 20:14:16 +0200 Subject: [PATCH] fix(backend): only validate member name if it's changed --- Foxnouns.Backend/Controllers/MembersController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Foxnouns.Backend/Controllers/MembersController.cs b/Foxnouns.Backend/Controllers/MembersController.cs index 1c4a783..76eaa20 100644 --- a/Foxnouns.Backend/Controllers/MembersController.cs +++ b/Foxnouns.Backend/Controllers/MembersController.cs @@ -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;