Replace image_serialzier helper with built-in serializers
This commit is contained in:
@ -19,7 +19,6 @@ from bookwyrm.settings import ENABLE_PREVIEW_IMAGES
|
||||
from .activitypub_mixin import ActivitypubMixin, ActivityMixin
|
||||
from .activitypub_mixin import OrderedCollectionPageMixin
|
||||
from .base_model import BookWyrmModel
|
||||
from .fields import image_serializer
|
||||
from .readthrough import ProgressMode
|
||||
from . import fields
|
||||
|
||||
@ -190,15 +189,8 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||
if hasattr(activity, "name"):
|
||||
activity.name = self.pure_name
|
||||
activity.type = self.pure_type
|
||||
activity.attachment = [
|
||||
image_serializer(b.cover, b.alt_text)
|
||||
for b in self.mention_books.all()[:4]
|
||||
if b.cover
|
||||
]
|
||||
if hasattr(self, "book") and self.book.cover:
|
||||
activity.attachment.append(
|
||||
image_serializer(self.book.cover, self.book.alt_text)
|
||||
)
|
||||
covers = [b.to_activity().get("cover") for b in [getattr(self, "book", None)] + list(self.mention_books.all()) if b]
|
||||
activity.attachment = covers
|
||||
return activity
|
||||
|
||||
def to_activity(self, pure=False): # pylint: disable=arguments-differ
|
||||
|
Reference in New Issue
Block a user