forked from mirrors/bookwyrm
Small activitypub serialization issues
This commit is contained in:
parent
2463e64321
commit
a7d8376b6a
2 changed files with 3 additions and 5 deletions
|
@ -16,7 +16,7 @@ class Person(ActivityObject):
|
||||||
publicKey: PublicKey
|
publicKey: PublicKey
|
||||||
endpoints: Dict
|
endpoints: Dict
|
||||||
icon: Image = field(default=lambda: {})
|
icon: Image = field(default=lambda: {})
|
||||||
bookwyrmUser: str = False
|
bookwyrmUser: bool = False
|
||||||
manuallyApprovesFollowers: str = False
|
manuallyApprovesFollowers: str = False
|
||||||
discoverable: str = True
|
discoverable: str = True
|
||||||
type: str = 'Person'
|
type: str = 'Person'
|
||||||
|
|
|
@ -82,12 +82,9 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||||
''' send default icon if one isn't set '''
|
''' send default icon if one isn't set '''
|
||||||
if self.avatar:
|
if self.avatar:
|
||||||
url = self.avatar.url
|
url = self.avatar.url
|
||||||
# TODO not the right way to get the media type
|
|
||||||
media_type = 'image/%s' % url.split('.')[-1]
|
|
||||||
else:
|
else:
|
||||||
url = 'https://%s/static/images/default_avi.jpg' % DOMAIN
|
url = 'https://%s/static/images/default_avi.jpg' % DOMAIN
|
||||||
media_type = 'image/jpeg'
|
return activitypub.Image(url=url)
|
||||||
return activitypub.Image(media_type, url, 'Image')
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ap_public_key(self):
|
def ap_public_key(self):
|
||||||
|
@ -106,6 +103,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||||
activity_formatter=lambda x: x.split('@')[0]
|
activity_formatter=lambda x: x.split('@')[0]
|
||||||
),
|
),
|
||||||
ActivityMapping('name', 'name'),
|
ActivityMapping('name', 'name'),
|
||||||
|
ActivityMapping('bookwyrmUser', 'bookwyrm_user'),
|
||||||
ActivityMapping('inbox', 'inbox'),
|
ActivityMapping('inbox', 'inbox'),
|
||||||
ActivityMapping('outbox', 'outbox'),
|
ActivityMapping('outbox', 'outbox'),
|
||||||
ActivityMapping('followers', 'ap_followers'),
|
ActivityMapping('followers', 'ap_followers'),
|
||||||
|
|
Loading…
Reference in a new issue