kopia lustrzana https://github.com/snarfed/bridgy-fed
web.poll_feed_task: default actor/author to user
rodzic
6dac6dd60d
commit
81e675f79b
|
@ -1803,10 +1803,12 @@ class WebTest(TestCase):
|
|||
'verb': 'post',
|
||||
'id': 'https://user.com/post',
|
||||
'url': 'https://user.com/post',
|
||||
'actor': {'id': 'https://user.com/'},
|
||||
'object':{
|
||||
'objectType': 'note',
|
||||
'id': 'https://user.com/post',
|
||||
'url': 'https://user.com/post',
|
||||
'author': {'id': 'https://user.com/'},
|
||||
'content': 'I hereby ☕ post',
|
||||
},
|
||||
'feed_index': 0,
|
||||
|
@ -1879,10 +1881,12 @@ class WebTest(TestCase):
|
|||
'verb': 'post',
|
||||
'id': url,
|
||||
'url': url,
|
||||
'actor': {'id': 'https://user.com/'},
|
||||
'object':{
|
||||
'objectType': 'note',
|
||||
'id': url,
|
||||
'url': url,
|
||||
'author': {'id': 'https://user.com/'},
|
||||
'content': f'I hereby ☕ post {id}',
|
||||
'published': f'2012-12-0{day}T00:00:00+00:00',
|
||||
},
|
||||
|
|
6
web.py
6
web.py
|
@ -659,6 +659,12 @@ def poll_feed_task():
|
|||
published_last = None
|
||||
published_deltas = [] # timedeltas between entry published times
|
||||
for i, activity in enumerate(activities):
|
||||
# default actor and author to user
|
||||
activity.setdefault('actor', {}).setdefault('id', user.profile_id())
|
||||
activity.setdefault('object', {})\
|
||||
.setdefault('author', {})\
|
||||
.setdefault('id', user.profile_id())
|
||||
|
||||
logger.info(f'Converted to AS1: {json_dumps(activity, indent=2)}')
|
||||
|
||||
published = activity.get('object', {}).get('published')
|
||||
|
|
Ładowanie…
Reference in New Issue