core: fix api return code for user self-update

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-24 11:51:03 +02:00
parent e681654af7
commit 93bdea3769

View file

@ -308,7 +308,7 @@ class UserViewSet(UsedByMixin, ModelViewSet):
"""Allow users to change information on their own profile""" """Allow users to change information on their own profile"""
data = UserSelfSerializer(instance=User.objects.get(pk=request.user.pk), data=request.data) data = UserSelfSerializer(instance=User.objects.get(pk=request.user.pk), data=request.data)
if not data.is_valid(): if not data.is_valid():
return Response(data.errors) return Response(data.errors, status=400)
new_user = data.save() new_user = data.save()
# If we're impersonating, we need to update that user object # If we're impersonating, we need to update that user object
# since it caches the full object # since it caches the full object