🐛(backend) manage invitation partial update without email

An invitation can be updated to change its role. The front use a PATCH
sending only the changed role, so the email is missing in the
InivtationSerializer.validate method. We have to check first if an email
is present before working on it.
This commit is contained in:
Manuel Raynaud
2025-10-16 17:26:02 +02:00
committed by GitHub
parent 5908afb098
commit c048b2ae95
4 changed files with 45 additions and 1 deletions

View File

@@ -749,7 +749,8 @@ class InvitationSerializer(serializers.ModelSerializer):
if self.instance is None:
attrs["issuer"] = user
attrs["email"] = attrs["email"].lower()
if attrs.get("email"):
attrs["email"] = attrs["email"].lower()
return attrs