From 532b24884762d12b25889f59707bad8be2256c57 Mon Sep 17 00:00:00 2001 From: TLSM Date: Thu, 23 Jun 2022 02:11:03 -0400 Subject: [PATCH] Extend 'hole' search operator to comments. --- files/routes/search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/routes/search.py b/files/routes/search.py index b9d062193..231f2e589 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -179,7 +179,8 @@ def searchcomments(v): criteria = searchparse(query) - comments = g.db.query(Comment.id).filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks)) + comments = g.db.query(Comment.id).join(Comment.post) \ + .filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks)) if 'author' in criteria: comments = comments.filter(Comment.ghost == False) @@ -201,6 +202,9 @@ def searchcomments(v): if 'over18' in criteria: comments = comments.filter(Comment.over_18 == True) + if 'hole' in criteria: + comments = comments.filter(Submission.sub == criteria['hole']) + if t: now = int(time.time()) if t == 'hour':