Filter on other pages as well

This commit is contained in:
Julian Rota 2022-06-22 23:38:46 -04:00 committed by Ben Rog-Wilhelm
parent 420e3e1e8e
commit f736d660b6
3 changed files with 15 additions and 7 deletions

View file

@ -227,19 +227,21 @@ class Comment(Base):
if self.parent_comment_id: return f"t3_{self.parent_comment_id}"
elif self.parent_submission: return f"t2_{self.parent_submission}"
@property
def replies(self):
def replies(self, user):
if self.replies2 != None: return [x for x in self.replies2 if not x.author.shadowbanned]
author_id = None
if user:
author_id = user.id
if not self.parent_submission:
return sorted((x for x in self.child_comments
if x.author
and x.filter_state not in ('filtered', 'removed')
and (x.filter_state not in ('filtered', 'removed') or x.author_id == author_id)
and not x.author.shadowbanned),
key=lambda x: x.created_utc)
return sorted((x for x in self.child_comments
if x.author
and not x.author.shadowbanned
and x.filter_state not in ('filtered', 'removed')
and (x.filter_state not in ('filtered', 'removed') or x.author_id == author_id)
and x.author_id not in (AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)),
key=lambda x: x.realupvotes, reverse=True)