Skip to content

Commit 81e675f

Browse files
committed
web.poll_feed_task: default actor/author to user
1 parent 6dac6dd commit 81e675f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: tests/test_web.py

+4
Original file line numberDiff line numberDiff line change
@@ -1803,10 +1803,12 @@ def test_poll_feed_atom(self, mock_create_task, mock_get, _):
18031803
'verb': 'post',
18041804
'id': 'https://user.com/post',
18051805
'url': 'https://user.com/post',
1806+
'actor': {'id': 'https://user.com/'},
18061807
'object':{
18071808
'objectType': 'note',
18081809
'id': 'https://user.com/post',
18091810
'url': 'https://user.com/post',
1811+
'author': {'id': 'https://user.com/'},
18101812
'content': 'I hereby ☕ post',
18111813
},
18121814
'feed_index': 0,
@@ -1879,10 +1881,12 @@ def test_poll_feed_rss(self, mock_create_task, mock_get, _):
18791881
'verb': 'post',
18801882
'id': url,
18811883
'url': url,
1884+
'actor': {'id': 'https://user.com/'},
18821885
'object':{
18831886
'objectType': 'note',
18841887
'id': url,
18851888
'url': url,
1889+
'author': {'id': 'https://user.com/'},
18861890
'content': f'I hereby ☕ post {id}',
18871891
'published': f'2012-12-0{day}T00:00:00+00:00',
18881892
},

Diff for: web.py

+6
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,12 @@ def poll_feed_task():
659659
published_last = None
660660
published_deltas = [] # timedeltas between entry published times
661661
for i, activity in enumerate(activities):
662+
# default actor and author to user
663+
activity.setdefault('actor', {}).setdefault('id', user.profile_id())
664+
activity.setdefault('object', {})\
665+
.setdefault('author', {})\
666+
.setdefault('id', user.profile_id())
667+
662668
logger.info(f'Converted to AS1: {json_dumps(activity, indent=2)}')
663669

664670
published = activity.get('object', {}).get('published')

0 commit comments

Comments
 (0)