kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
d85ffaec04
commit
d724ae8cba
|
@ -31,6 +31,7 @@ SUPPORTED_TYPES = (
|
|||
'Like',
|
||||
'Note',
|
||||
'Undo',
|
||||
'Update',
|
||||
'Video',
|
||||
)
|
||||
|
||||
|
@ -80,6 +81,11 @@ def inbox(domain=None):
|
|||
# skip actor fetch below; we don't need it to undo a follow
|
||||
undo_follow(redirect_unwrap(activity))
|
||||
return ''
|
||||
elif type == 'Update':
|
||||
if obj.get('type') == 'Person':
|
||||
return '' # noop
|
||||
else:
|
||||
error(f'Sorry, {type} activities are not supported yet.', status=501)
|
||||
elif type == 'Delete':
|
||||
# we currently only actually delete followers for Deletes that are sent
|
||||
# to the shared inbox, not individual users' inboxes, to help scaling
|
||||
|
|
|
@ -148,6 +148,26 @@ DELETE = {
|
|||
'object': 'https://mastodon.social/users/swentel',
|
||||
}
|
||||
|
||||
UPDATE_PERSON = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': 'https://a/person#update',
|
||||
'type': 'Update',
|
||||
'actor': 'https://mastodon.social/users/swentel',
|
||||
'object': {
|
||||
'type': 'Person',
|
||||
'id': 'https://a/person',
|
||||
},
|
||||
}
|
||||
UPDATE_NOTE = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': 'https://a/note#update',
|
||||
'type': 'Update',
|
||||
'actor': 'https://mastodon.social/users/swentel',
|
||||
'object': {
|
||||
'type': 'Note',
|
||||
'id': 'https://a/note',
|
||||
},
|
||||
}
|
||||
|
||||
@patch('requests.post')
|
||||
@patch('requests.get')
|
||||
|
@ -652,6 +672,16 @@ class ActivityPubTest(testutil.TestCase):
|
|||
self.assertEqual('inactive', followee.key.get().status)
|
||||
self.assertEqual('active', other.key.get().status)
|
||||
|
||||
def test_update_person_noop(self, _, __, ___):
|
||||
"""Updates to Person objects do nothing."""
|
||||
got = self.client.post('/inbox', json=UPDATE_PERSON)
|
||||
self.assertEqual(200, got.status_code)
|
||||
|
||||
def test_update_note_not_implemented(self, _, __, ___):
|
||||
"""Updates to non-Person objects are not implemented."""
|
||||
got = self.client.post('/inbox', json=UPDATE_NOTE)
|
||||
self.assertEqual(501, got.status_code)
|
||||
|
||||
def test_inbox_webmention_discovery_connection_fails(self, mock_head,
|
||||
mock_get, mock_post):
|
||||
mock_get.side_effect = [
|
||||
|
@ -817,7 +847,6 @@ class ActivityPubTest(testutil.TestCase):
|
|||
'items': [ACTOR],
|
||||
}, resp.json)
|
||||
|
||||
|
||||
def test_outbox_empty(self, _, mock_get, __):
|
||||
resp = self.client.get(f'/foo.com/outbox')
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
|
Ładowanie…
Reference in New Issue