From 1e76430f74db6b575fbc65794ed72c1c0a50d310 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 7 Sep 2023 21:54:42 -0600 Subject: [PATCH] Don't show identity pages for remote identities --- core/html.py | 2 ++ users/views/identity.py | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/html.py b/core/html.py index 68d66ff..0e0cf60 100644 --- a/core/html.py +++ b/core/html.py @@ -91,6 +91,8 @@ class FediverseHtmlParser(HTMLParser): for mention in mentions or []: if self.uri_domain: url = mention.absolute_profile_uri() + elif not mention.local: + url = mention.profile_uri else: url = str(mention.urls.view) if mention.username: diff --git a/users/views/identity.py b/users/views/identity.py index c002938..cf998ff 100644 --- a/users/views/identity.py +++ b/users/views/identity.py @@ -17,7 +17,7 @@ from activities.services import SearchService, TimelineService from core.decorators import cache_page, cache_page_by_ap_json from core.ld import canonicalise from core.models import Config -from users.models import Domain, FollowStates, Identity, IdentityStates +from users.models import Domain, FollowStates, Identity from users.services import IdentityService from users.shortcuts import by_handle_or_404 @@ -35,18 +35,16 @@ class ViewIdentity(ListView): with_replies = False def get(self, request, handle): - # Make sure we understand this handle + # Grab the handle if we have it (no live fetching here) self.identity = by_handle_or_404( self.request, handle, local=False, - fetch=True, + fetch=False, ) - if ( - not self.identity.local - and self.identity.data_age > Config.system.identity_max_age - ): - self.identity.transition_perform(IdentityStates.outdated) + # If it's remote, redirect to its profile page + if not self.identity.local: + return redirect(self.identity.profile_uri) # If they're coming in looking for JSON, they want the actor if request.ap_json: # Return actor info