diff --git a/tests/test_web.py b/tests/test_web.py index 8311f9e..76bbed5 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -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', }, diff --git a/web.py b/web.py index eba8f02..0617b07 100644 --- a/web.py +++ b/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')