user page bug fix for 133d640f1d

pull/962/head
Ryan Barrett 2024-04-12 07:15:33 -07:00
rodzic f67cecd8f9
commit ea1f3dce49
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 37 dodań i 23 usunięć

Wyświetl plik

@ -1271,11 +1271,10 @@ def fetch_objects(query, by=None, user=None):
'content': 'their profile', 'content': 'their profile',
'url': id, 'url': id,
}) })
elif url: elif url and not content:
# heuristics for sniffing URLs and converting them to more friendly # heuristics for sniffing URLs and converting them to more friendly
# phrases and user handles. # phrases and user handles.
# TODO: standardize this into granary.as2 somewhere? # TODO: standardize this into granary.as2 somewhere?
if not content:
from activitypub import FEDI_URL_RE from activitypub import FEDI_URL_RE
from atproto import COLLECTION_TO_TYPE, did_to_handle from atproto import COLLECTION_TO_TYPE, did_to_handle
@ -1286,7 +1285,7 @@ def fetch_objects(query, by=None, user=None):
elif match := BSKY_APP_URL_RE.match(url): elif match := BSKY_APP_URL_RE.match(url):
id = match.group('id') id = match.group('id')
if id.startswith('did:'): if id.startswith('did:'):
id = ATdid_to_handle(id) or id id = did_to_handle(id) or id
content = '@' + id content = '@' + id
if match.group('tid'): if match.group('tid'):
content += "'s post" content += "'s post"

Wyświetl plik

@ -353,6 +353,21 @@ class Protocol:
return (None, None) return (None, None)
@classmethod
def bridged_web_url_for(self, user):
"""Returns the web URL for a user's bridged profile in this protocol.
For example, for Web user ``alice.com``, :meth:`ATProto.bridged_web_url_for`
returns ``https://bsky.app/profile/alice.com.web.brid.gy``
Args:
proto (str or Protocol)
Returns:
str, or None if there isn't a canonical URL
"""
return None
@classmethod @classmethod
def actor_key(cls, obj): def actor_key(cls, obj):
"""Returns the :class:`User`: key for a given object's author or actor. """Returns the :class:`User`: key for a given object's author or actor.