Serialize links for books

This commit is contained in:
Mouse Reeve
2021-12-15 17:10:59 -08:00
parent 86b294afd7
commit 5c99f142f9
5 changed files with 45 additions and 30 deletions

View File

@ -344,6 +344,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
def delete(self, *args, **kwargs):
"""deactivate rather than delete a user"""
# pylint: disable=attribute-defined-outside-init
self.is_active = False
# skip the logic in this class's save()
super().save(*args, **kwargs)
@ -404,14 +405,6 @@ class KeyPair(ActivitypubMixin, BookWyrmModel):
self.private_key, self.public_key = create_key_pair()
return super().save(*args, **kwargs)
def to_activity(self, **kwargs):
"""override default AP serializer to add context object
idk if this is the best way to go about this"""
activity_object = super().to_activity(**kwargs)
del activity_object["@context"]
del activity_object["type"]
return activity_object
class AnnualGoal(BookWyrmModel):
"""set a goal for how many books you read in a year"""