Merge branch 'image-serialize' into user-export

pulls Mouse's fix for imagefile serialization
This commit is contained in:
Hugh Rundle 2024-01-28 15:12:15 +11:00
commit 582e97e4a5
No known key found for this signature in database
GPG key ID: A7E35779918253F9
3 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,5 @@
""" actor serializer """ """ actor serializer """
from dataclasses import dataclass, field from dataclasses import dataclass
from typing import Dict from typing import Dict
from .base_activity import ActivityObject from .base_activity import ActivityObject
@ -35,7 +35,7 @@ class Person(ActivityObject):
endpoints: Dict = None endpoints: Dict = None
name: str = None name: str = None
summary: str = None summary: str = None
icon: Image = field(default_factory=lambda: {}) icon: Image = None
bookwyrmUser: bool = False bookwyrmUser: bool = False
manuallyApprovesFollowers: str = False manuallyApprovesFollowers: str = False
discoverable: str = False discoverable: str = False

View file

@ -482,7 +482,7 @@ class ImageField(ActivitypubFieldMixin, models.ImageField):
if not url: if not url:
return None return None
return activitypub.Document(url=url, name=alt) return activitypub.Image(url=url, name=alt)
def field_from_activity(self, value, allow_external_connections=True): def field_from_activity(self, value, allow_external_connections=True):
image_slug = value image_slug = value

View file

@ -438,7 +438,7 @@ class ModelFields(TestCase):
) )
) )
self.assertEqual(output.name, "") self.assertEqual(output.name, "")
self.assertEqual(output.type, "Document") self.assertEqual(output.type, "Image")
@responses.activate @responses.activate
def test_image_field_from_activity(self, *_): def test_image_field_from_activity(self, *_):