core: fix UserSelfSerializer's save() overwriting other user attributes
closes #2070 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -156,6 +156,13 @@ class UserSelfSerializer(ModelSerializer):
|
||||
raise ValidationError("Not allowed to change username.")
|
||||
return username
|
||||
|
||||
def save(self, **kwargs):
|
||||
if self.instance:
|
||||
attributes: dict = self.instance.attributes
|
||||
attributes.update(self.validated_data.get("attributes", {}))
|
||||
self.validated_data["attributes"] = attributes
|
||||
return super().save(**kwargs)
|
||||
|
||||
class Meta:
|
||||
|
||||
model = User
|
||||
|
||||
Reference in New Issue
Block a user