From fb98ef4b384f6fb2643623782cd3ffd551b9ebb8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 19 Feb 2021 11:16:01 -0800 Subject: [PATCH] Remove redundant activitypub dataclass --- bookwyrm/activitypub/__init__.py | 2 +- bookwyrm/activitypub/verbs.py | 8 +------- bookwyrm/models/shelf.py | 2 +- bookwyrm/models/tag.py | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bookwyrm/activitypub/__init__.py b/bookwyrm/activitypub/__init__.py index 5303d1b2..f06154ab 100644 --- a/bookwyrm/activitypub/__init__.py +++ b/bookwyrm/activitypub/__init__.py @@ -15,7 +15,7 @@ from .response import ActivitypubResponse from .book import Edition, Work, Author from .verbs import Create, Delete, Undo, Update from .verbs import Follow, Accept, Reject, Block -from .verbs import Add, AddBook, AddListItem, Remove +from .verbs import Add, AddListItem, Remove from .verbs import Announce, Like # this creates a list of all the Activity types that we can serialize, diff --git a/bookwyrm/activitypub/verbs.py b/bookwyrm/activitypub/verbs.py index aa6e7eee..6f1a4d44 100644 --- a/bookwyrm/activitypub/verbs.py +++ b/bookwyrm/activitypub/verbs.py @@ -132,13 +132,7 @@ class Add(Verb): @dataclass(init=False) -class AddBook(Add): - '''Add activity that's aware of the book obj ''' - object: Edition - - -@dataclass(init=False) -class AddListItem(AddBook): +class AddListItem(Add): '''Add activity that's aware of the book obj ''' notes: str = None order: int = 0 diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py index 921b8617..dfb8b9b3 100644 --- a/bookwyrm/models/shelf.py +++ b/bookwyrm/models/shelf.py @@ -57,7 +57,7 @@ class ShelfBook(CollectionItemMixin, BookWyrmModel): user = fields.ForeignKey( 'User', on_delete=models.PROTECT, activitypub_field='actor') - activity_serializer = activitypub.AddBook + activity_serializer = activitypub.Add object_field = 'book' collection_field = 'shelf' diff --git a/bookwyrm/models/tag.py b/bookwyrm/models/tag.py index d75f6e05..12645b9e 100644 --- a/bookwyrm/models/tag.py +++ b/bookwyrm/models/tag.py @@ -50,7 +50,7 @@ class UserTag(CollectionItemMixin, BookWyrmModel): tag = fields.ForeignKey( 'Tag', on_delete=models.PROTECT, activitypub_field='target') - activity_serializer = activitypub.AddBook + activity_serializer = activitypub.Add object_field = 'book' collection_field = 'tag'