kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
7867326ebe
commit
0d24fafefc
|
@ -18,7 +18,8 @@ from models import Object
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# contains (str action, dict record) tuples
|
||||
# contains (str action, dict record or str path) tuples. second element is a
|
||||
# dict record for creates and updates, str path for deletes.
|
||||
new_commits = SimpleQueue()
|
||||
|
||||
|
||||
|
@ -71,6 +72,9 @@ def subscribe():
|
|||
is_ours = repo in our_atproto_dids
|
||||
if is_ours and action == 'delete':
|
||||
logger.info(f'Got delete from our ATProto user: {repo} {path}')
|
||||
# TODO: also detect deletes of records that *reference* our bridged
|
||||
# users, eg a delete of a follow or like or repost of them.
|
||||
# not easy because we need to getRecord the record to check
|
||||
new_commits.put(('delete', path))
|
||||
continue
|
||||
|
||||
|
|
|
@ -294,6 +294,24 @@ class ATProtoFirehoseSubscribeTest(TestCase):
|
|||
def test_delete_by_other(self):
|
||||
self.assert_doesnt_enqueue(action='delete')
|
||||
|
||||
def test_update_by_our_atproto_user(self):
|
||||
self.store_object(id='did:plc:user', raw=DID_DOC)
|
||||
user = self.make_user('did:plc:user', cls=ATProto,
|
||||
enabled_protocols=['eefake'],
|
||||
obj_bsky=ACTOR_PROFILE_BSKY)
|
||||
|
||||
path = 'app.bsky.feed.post/abc123'
|
||||
self.assert_enqueues(expected=path, path=path, action='delete')
|
||||
|
||||
def test_update_by_other(self):
|
||||
self.assert_doesnt_enqueue(action='delete', path='app.bsky.feed.post/abc123')
|
||||
|
||||
def test_update_like_of_our_user(self):
|
||||
self.assert_enqueues(action='update', record={
|
||||
'$type': 'app.bsky.feed.like',
|
||||
'subject': {'uri': 'at://did:alice/app.bsky.feed.post/tid'},
|
||||
})
|
||||
|
||||
|
||||
@skip
|
||||
class ATProtoFirehoseHandleTest(TestCase):
|
||||
|
|
Ładowanie…
Reference in New Issue