Don't show identity pages for remote identities

This commit is contained in:
Andrew Godwin 2023-09-07 21:54:42 -06:00
parent ddf24d376e
commit 1e76430f74
2 changed files with 8 additions and 8 deletions

View File

@ -91,6 +91,8 @@ class FediverseHtmlParser(HTMLParser):
for mention in mentions or []: for mention in mentions or []:
if self.uri_domain: if self.uri_domain:
url = mention.absolute_profile_uri() url = mention.absolute_profile_uri()
elif not mention.local:
url = mention.profile_uri
else: else:
url = str(mention.urls.view) url = str(mention.urls.view)
if mention.username: if mention.username:

View File

@ -17,7 +17,7 @@ from activities.services import SearchService, TimelineService
from core.decorators import cache_page, cache_page_by_ap_json from core.decorators import cache_page, cache_page_by_ap_json
from core.ld import canonicalise from core.ld import canonicalise
from core.models import Config 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.services import IdentityService
from users.shortcuts import by_handle_or_404 from users.shortcuts import by_handle_or_404
@ -35,18 +35,16 @@ class ViewIdentity(ListView):
with_replies = False with_replies = False
def get(self, request, handle): 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.identity = by_handle_or_404(
self.request, self.request,
handle, handle,
local=False, local=False,
fetch=True, fetch=False,
) )
if ( # If it's remote, redirect to its profile page
not self.identity.local if not self.identity.local:
and self.identity.data_age > Config.system.identity_max_age return redirect(self.identity.profile_uri)
):
self.identity.transition_perform(IdentityStates.outdated)
# If they're coming in looking for JSON, they want the actor # If they're coming in looking for JSON, they want the actor
if request.ap_json: if request.ap_json:
# Return actor info # Return actor info