diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index fef560a1..287d4e9a 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -137,7 +137,11 @@ def user_profile(actor): """ Requests to this endpoint can be for a JSON representation of the user, or a HTML rendering of their profile. The two types of requests are differentiated by the header """ actor = actor.strip() - user = User.query.filter_by(user_name=actor, deleted=False, banned=False, ap_id=None).first() + if '@' in actor: + user = User.query.filter_by(ap_id=actor, deleted=False, banned=False).first() + else: + user = User.query.filter_by(user_name=actor, deleted=False, banned=False, ap_id=None).first() + if user is not None: if 'application/ld+json' in request.headers.get('Accept', ''): server = current_app.config['SERVER_NAME'] diff --git a/app/templates/base.html b/app/templates/base.html index 246d090a..ae87e0c9 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -2,7 +2,7 @@ {% if user.deleted %} [deleted] {% else %} - {{ user.user_name }} + {{ user.user_name if user.ap_id == none else user.ap_id }} {% endif %} {% endmacro %} diff --git a/app/templates/user/show_profile.html b/app/templates/user/show_profile.html index 636b720b..c0fce66f 100644 --- a/app/templates/user/show_profile.html +++ b/app/templates/user/show_profile.html @@ -15,14 +15,14 @@ -

{{ user.user_name }}

+

{{ user.user_name if user.ap_id == none else user.ap_id }}

{% elif user.avatar_image() != '' %}
-

{{ user.user_name }}

+

{{ user.user_name if user.ap_id == none else user.ap_id }}

{% else %} @@ -33,7 +33,7 @@ -

{{ user.user_name }}

+

{{ user.user_name if user.ap_id == none else user.ap_id }}

{{ user.about_html|safe }} {% endif %}