Merge branch 'avatar-change' into 'develop'
Fixed UI crash when updating avatar See merge request funkwhale/funkwhale!1101
This commit is contained in:
commit
5fcdabf305
|
@ -179,6 +179,13 @@ class UserWriteSerializer(serializers.ModelSerializer):
|
|||
obj.actor.save(update_fields=["attachment_icon"])
|
||||
return obj
|
||||
|
||||
def to_representation(self, instance):
|
||||
r = super().to_representation(instance)
|
||||
r["avatar"] = common_serializers.AttachmentSerializer(
|
||||
instance.get_avatar()
|
||||
).data
|
||||
return r
|
||||
|
||||
|
||||
class UserReadSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
|
|
@ -319,6 +319,7 @@ def test_user_can_patch_their_own_avatar(logged_in_api_client, factories):
|
|||
user.refresh_from_db()
|
||||
|
||||
assert user.actor.attachment_icon == attachment
|
||||
assert "avatar" in response.data
|
||||
|
||||
|
||||
def test_creating_user_creates_actor_as_well(
|
||||
|
|
Loading…
Reference in New Issue