Don't error when retrieving existing user

Happens when a user is not yet fetched but we look them up via a
successful webfinger
This commit is contained in:
Andrew Godwin 2022-11-20 17:17:53 -07:00
parent a351c6b117
commit bed5c7ffaa
1 changed files with 6 additions and 0 deletions

View File

@ -165,6 +165,12 @@ class Identity(StatorModel):
) )
if handle is None: if handle is None:
return None return None
# See if this actually does match an existing actor
try:
return cls.objects.get(actor_uri=actor_uri)
except cls.DoesNotExist:
pass
# OK, make one
username, domain = handle.split("@") username, domain = handle.split("@")
domain = Domain.get_remote_domain(domain) domain = Domain.get_remote_domain(domain)
return cls.objects.create( return cls.objects.create(