From e38e985e733312c5f7f82cf372ab2ed57446e1c2 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 28 Dec 2022 11:12:40 -0700 Subject: [PATCH] Fall post URLs back to their ID Fixes #302 --- activities/models/post.py | 2 +- activities/services/search.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/activities/models/post.py b/activities/models/post.py index e9bc885..40e5915 100644 --- a/activities/models/post.py +++ b/activities/models/post.py @@ -708,7 +708,7 @@ class Post(StatorModel): raise ValueError("Post has no content or content map") post.summary = data.get("summary") post.sensitive = data.get("sensitive", False) - post.url = data.get("url") + post.url = data.get("url", data["id"]) post.published = parse_ld_date(data.get("published")) post.edited = parse_ld_date(data.get("updated")) post.in_reply_to = data.get("inReplyTo") diff --git a/activities/services/search.py b/activities/services/search.py index a2b2d94..3d297fe 100644 --- a/activities/services/search.py +++ b/activities/services/search.py @@ -83,13 +83,11 @@ class SearchService: type = document.get("type", "unknown").lower() # Is it an identity? - print(type) if type in Identity.ACTOR_TYPES: # Try and retrieve the profile by actor URI identity = Identity.by_actor_uri(document["id"], create=True) - print("got identity") if identity and identity.state == IdentityStates.outdated: - print(async_to_sync(identity.fetch_actor)()) + async_to_sync(identity.fetch_actor)() return identity # Is it a post?