Fixes serialization of parent work remote_id

This commit is contained in:
Mouse Reeve 2020-11-02 14:13:24 -08:00
parent 0c9dff61ca
commit c5a215b11d
2 changed files with 7 additions and 3 deletions

View file

@ -8,7 +8,7 @@ from .base_activity import ActivityObject
class Like(ActivityObject):
''' a user faving an object '''
actor: str
object: str
object: ActivityObject
type: str = 'Like'
@ -16,5 +16,5 @@ class Like(ActivityObject):
class Boost(ActivityObject):
''' boosting a status '''
actor: str
object: str
object: ActivityObject
type: str = 'Announce'

View file

@ -67,6 +67,10 @@ class Book(ActivitypubMixin, BookWyrmModel):
url='https://%s%s' % (DOMAIN, self.cover.url),
)]
@property
def ap_parent_work(self):
''' reference the work via local id not remote '''
return self.parent_work.local_id
activity_mappings = [
ActivityMapping('id', 'remote_id'),
@ -89,7 +93,7 @@ class Book(ActivitypubMixin, BookWyrmModel):
ActivityMapping('librarything_key', 'librarything_key'),
ActivityMapping('goodreads_key', 'goodreads_key'),
ActivityMapping('work', 'parent_work'),
ActivityMapping('work', 'ap_parent_work'),
ActivityMapping('isbn_10', 'isbn_10'),
ActivityMapping('isbn_13', 'isbn_13'),
ActivityMapping('oclc_number', 'oclc_number'),