From 1bccffaa9bda7b70de75394ba5281a5033c24ac9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 27 Aug 2024 11:34:35 -0700 Subject: [PATCH] Uses separate activitypub type of suggestion lists --- bookwyrm/activitypub/__init__.py | 2 +- bookwyrm/activitypub/ordered_collection.py | 10 +++++++++- bookwyrm/models/list.py | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bookwyrm/activitypub/__init__.py b/bookwyrm/activitypub/__init__.py index 41decd68a..0705dc241 100644 --- a/bookwyrm/activitypub/__init__.py +++ b/bookwyrm/activitypub/__init__.py @@ -15,7 +15,7 @@ from .note import Review, Rating from .note import Tombstone from .ordered_collection import OrderedCollection, OrderedCollectionPage from .ordered_collection import CollectionItem, ListItem, ShelfItem -from .ordered_collection import BookList, Shelf +from .ordered_collection import BookList, SuggestionList, Shelf from .person import Person, PublicKey from .response import ActivitypubResponse from .book import Edition, Work, Author diff --git a/bookwyrm/activitypub/ordered_collection.py b/bookwyrm/activitypub/ordered_collection.py index 7d811331c..a88d37328 100644 --- a/bookwyrm/activitypub/ordered_collection.py +++ b/bookwyrm/activitypub/ordered_collection.py @@ -39,10 +39,18 @@ class BookList(OrderedCollectionPrivate): summary: str = None curation: str = "closed" - book: str = None type: str = "BookList" +@dataclass(init=False) +class SuggestionList(OrderedCollectionPrivate): + """structure of an ordered collection activity""" + + summary: str = None + book: str = None + type: str = "SuggestionList" + + # pylint: disable=invalid-name @dataclass(init=False) class OrderedCollectionPage(ActivityObject): diff --git a/bookwyrm/models/list.py b/bookwyrm/models/list.py index 3301983cb..1becf8f08 100644 --- a/bookwyrm/models/list.py +++ b/bookwyrm/models/list.py @@ -69,6 +69,7 @@ class SuggestionList(AbstractList): related_name="suggestion_list", unique=True, ) + activity_serializer = activitypub.SuggestionList @property def collection_queryset(self):