summaryrefslogtreecommitdiffstats
path: root/activities/views
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-04 21:22:20 -0700
committerAndrew Godwin2022-12-04 21:22:20 -0700
commit107c3d6cf8eaffedc6aee8057903a62f36346fb9 (patch)
treebdf662fe1d18db0f7530aa1e5b29a579e0237ce1 /activities/views
parent93ccb5dd32f4e3942d08814e5a86fb30c90c9ff6 (diff)
downloadtakahe-107c3d6cf8eaffedc6aee8057903a62f36346fb9.tar.gz
takahe-107c3d6cf8eaffedc6aee8057903a62f36346fb9.tar.bz2
takahe-107c3d6cf8eaffedc6aee8057903a62f36346fb9.zip
Fetch post parents live too
Diffstat (limited to 'activities/views')
-rw-r--r--activities/views/posts.py7
-rw-r--r--activities/views/search.py6
2 files changed, 5 insertions, 8 deletions
diff --git a/activities/views/posts.py b/activities/views/posts.py
index 8b0ff33..ef16713 100644
--- a/activities/views/posts.py
+++ b/activities/views/posts.py
@@ -33,9 +33,10 @@ class Individual(TemplateView):
def get_context_data(self):
if self.post_obj.in_reply_to:
- parent = Post.objects.filter(object_uri=self.post_obj.in_reply_to).first()
- else:
- parent = None
+ try:
+ parent = Post.by_object_uri(self.post_obj.in_reply_to, fetch=True)
+ except Post.DoesNotExist:
+ parent = None
return {
"identity": self.identity,
"post": self.post_obj,
diff --git a/activities/views/search.py b/activities/views/search.py
index ab37e17..ccfc1a4 100644
--- a/activities/views/search.py
+++ b/activities/views/search.py
@@ -101,11 +101,7 @@ class Search(FormView):
# Try and retrieve the post by URI
# (we do not trust the JSON we just got - fetch from source!)
try:
- post = Post.by_object_uri(document["id"], fetch=True)
- # We may need to live-fetch the identity too
- if post.author.state == IdentityStates.outdated:
- async_to_sync(post.author.fetch_actor)()
- return post
+ return Post.by_object_uri(document["id"], fetch=True)
except Post.DoesNotExist:
return None