Don't error when we don't have a parent post

This commit is contained in:
Andrew Godwin 2022-12-24 12:27:37 -07:00
parent 834282cf54
commit 365b9d49c6
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ class PostService:
ancestors: list[Post] = [] ancestors: list[Post] = []
ancestor = self.post ancestor = self.post
while ancestor.in_reply_to and len(ancestors) < num_ancestors: while ancestor.in_reply_to and len(ancestors) < num_ancestors:
ancestor = self.queryset().get(object_uri=ancestor.in_reply_to) ancestor = self.queryset().filter(object_uri=ancestor.in_reply_to).first()
if ancestor is None: if ancestor is None:
break break
if ancestor.state in [PostStates.deleted, PostStates.deleted_fanned_out]: if ancestor.state in [PostStates.deleted, PostStates.deleted_fanned_out]: