kopia lustrzana https://github.com/snarfed/bridgy-fed
Protocol.receive: more undo handling, mark object as deleted
also add undo test for #1243pull/1261/head
rodzic
4c12c087ac
commit
303ea175cf
|
@ -904,8 +904,7 @@ class Protocol:
|
|||
|
||||
# fall through to deliver to followers
|
||||
|
||||
# TODO: add undo here, test for it
|
||||
elif obj.type == 'delete':
|
||||
elif obj.type in ('delete', 'undo'):
|
||||
if not inner_obj_id:
|
||||
error("Couldn't find id of object to delete")
|
||||
|
||||
|
|
|
@ -2240,7 +2240,7 @@ class ProtocolReceiveTest(TestCase):
|
|||
'actor': 'fake:user',
|
||||
'object': 'other:eve',
|
||||
}
|
||||
self.store_object(id='fake:block', our_as1=block)
|
||||
self.store_object(id='fake:block', our_as1=block, source_protocol='fake')
|
||||
|
||||
self.assertEqual(('OK', 202), Fake.receive_as1({
|
||||
'objectType': 'activity',
|
||||
|
@ -2251,6 +2251,36 @@ class ProtocolReceiveTest(TestCase):
|
|||
}))
|
||||
self.assertEqual([('fake:undo', 'fake:block:target')], Fake.sent)
|
||||
|
||||
def test_undo_repost(self):
|
||||
self.make_followers()
|
||||
|
||||
self.store_object(id='fake:post', source_protocol='fake', our_as1={
|
||||
'objectType': 'note',
|
||||
'id': 'fake:post',
|
||||
'actor': 'fake:user',
|
||||
})
|
||||
self.store_object(id='fake:repost', source_protocol='fake', our_as1={
|
||||
'objectType': 'activity',
|
||||
'verb': 'share',
|
||||
'id': 'fake:repost',
|
||||
'actor': 'fake:user',
|
||||
'object': 'fake:post',
|
||||
})
|
||||
|
||||
self.assertEqual(('OK', 202), Fake.receive_as1({
|
||||
'objectType': 'activity',
|
||||
'verb': 'undo',
|
||||
'id': 'fake:undo',
|
||||
'actor': 'fake:user',
|
||||
'object': 'fake:repost',
|
||||
}))
|
||||
self.assertTrue(Object.get_by_id('fake:repost').deleted)
|
||||
self.assertEqual([
|
||||
('fake:undo', 'fake:post:target'),
|
||||
('fake:undo', 'fake:repost:target'),
|
||||
('fake:undo', 'fake:shared:target'),
|
||||
], Fake.sent)
|
||||
|
||||
@skip
|
||||
def test_from_bridgy_fed_domain_fails(self):
|
||||
with self.assertRaises(BadRequest):
|
||||
|
|
Ładowanie…
Reference in New Issue