@ -1,7 +1,17 @@
|
||||
''' actor serializer '''
|
||||
from fedireads.settings import DOMAIN
|
||||
|
||||
def get_actor(user):
|
||||
''' activitypub actor from db User '''
|
||||
avatar = user.avatar
|
||||
|
||||
icon_path = '/static/images/default_avi.jpg'
|
||||
icon_type = 'image/jpeg'
|
||||
if avatar:
|
||||
icon_path = avatar.url
|
||||
icon_type = 'image/%s' % icon_path.split('.')[-1]
|
||||
|
||||
icon_url = 'https://%s%s' % (DOMAIN, icon_path)
|
||||
return {
|
||||
'@context': [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
@ -33,5 +43,10 @@ def get_actor(user):
|
||||
},
|
||||
'fedireadsUser': True,
|
||||
'manuallyApprovesFollowers': user.manually_approves_followers,
|
||||
"icon": {
|
||||
"type": "Image",
|
||||
"mediaType": icon_type,
|
||||
"url": icon_url,
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user