From 386bfa1f3bbef41cba4d4fef6772b887c3fd7626 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 2 Jul 2022 13:02:03 +0200 Subject: [PATCH] fix 500 error --- files/classes/comment.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 187aa717b..f8d291f6e 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -208,14 +208,13 @@ class Comment(Base): @lazy def replies(self, sort=None): if self.replies2 != None: - return [x for x in self.replies2 if not x.author.shadowbanned] - - if not self.parent_submission: - return g.db.query(Comment).options( - joinedload(Comment.author) - ).filter_by(parent_comment_id=self.id, shadowbanned=None).order_by(Comment.id).all() + replies = self.replies2 + elif not self.parent_submission: + replies = g.db.query(Comment).filter_by(parent_comment_id=self.id).order_by(Comment.id).all() + else: + return self.child_comments - return [x for x in self.child_comments if not x.author.shadowbanned] + return [x for x in replies if not x.author.shadowbanned] @lazy