atproto: self label profiles with 'bridged-from-[protocol]'

fixes #827
pull/910/head
Ryan Barrett 2024-03-01 13:31:18 -08:00
rodzic 4f239c92e5
commit c2b8db8687
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
4 zmienionych plików z 21 dodań i 0 usunięć

Wyświetl plik

@ -230,6 +230,11 @@ class ATProto(User, Protocol):
if user.obj and user.obj.as1:
# create user profile
profile = cls.convert(user.obj, fetch_blobs=True)
profile.setdefault('labels', {'$type': 'com.atproto.label.defs#selfLabels'})
profile['labels'].setdefault('values', []).append({
'val' : f'bridged-from-{user.LABEL}',
})
profile_json = json_dumps(dag_json.encode(profile).decode(), indent=2)
logger.info(f'Storing ATProto app.bsky.actor.profile self: {profile_json}')
initial_writes = [Write(

Wyświetl plik

@ -461,6 +461,10 @@ class ATProtoTest(TestCase):
'ref': BLOB_CID,
'size': 8,
},
'labels': {
'$type': 'com.atproto.label.defs#selfLabels',
'values': [{'val' : 'bridged-from-fake'}],
},
}, profile)
uri = arroba.util.at_uri(did, 'app.bsky.actor.profile', 'self')
@ -564,6 +568,10 @@ class ATProtoTest(TestCase):
'mimeType': 'image/png',
'size': 13,
},
'labels': {
'$type': 'com.atproto.label.defs#selfLabels',
'values': [{'val' : 'bridged-from-fake'}],
},
}, profile)
last_tid = arroba.util.int_to_tid(arroba.util._tid_ts_last)
record = repo.get_record('app.bsky.feed.post', last_tid)

Wyświetl plik

@ -95,6 +95,10 @@ class UserTest(TestCase):
'$type': 'app.bsky.actor.profile',
'displayName': 'Alice',
'description': 'hi there',
'labels': {
'$type': 'com.atproto.label.defs#selfLabels',
'values': [{'val' : 'bridged-from-fake'}],
},
}, profile)
uri = at_uri(did, 'app.bsky.actor.profile', 'self')

Wyświetl plik

@ -430,6 +430,10 @@ class PagesTest(TestCase):
'$type': 'app.bsky.actor.profile',
'displayName': 'Alice',
'description': 'hi there',
'labels': {
'$type': 'com.atproto.label.defs#selfLabels',
'values': [{'val' : 'bridged-from-fake'}],
},
}, profile)
at_uri = f'at://{did}/app.bsky.actor.profile/self'