/webmention: check that user exists at the beginning, not the end

pull/424/head
Ryan Barrett 2023-02-10 10:53:39 -08:00
rodzic 95b1fd5a29
commit ad63e23aeb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -53,6 +53,10 @@ class Webmention(View):
self.source_domain = util.domain_from_link(source, minimize=False)
logger.info(f'webmention from {self.source_domain}')
self.user = User.get_by_id(self.source_domain)
if not self.user:
error(f'No user found for domain {self.source_domain}')
# if source is home page, send an actor Update to followers' instances
if source.strip('/') == f'https://{self.source_domain}':
self.user = User.get_by_id(self.source_domain)
@ -121,10 +125,6 @@ class Webmention(View):
))
logger.info(f'Converted webmention to AS1: {type_label}: {json_dumps(self.source_as1, indent=2)}')
self.user = User.get_by_id(self.source_domain)
if not self.user:
error(f'No user found for domain {self.source_domain}')
ret = self.try_activitypub()
return ret or 'No ActivityPub targets'