diff --git a/files/routes/search.py b/files/routes/search.py index c6073a82d..004a6c431 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -156,6 +156,9 @@ def searchposts(v:User): posts = apply_time_filter(t, posts, Submission) + if not v.can_see_shadowbanned: + posts = posts.join(Submission.author).filter(User.shadowbanned == None) + total = posts.count() posts = sort_objects(sort, posts, Submission) @@ -264,6 +267,9 @@ def searchcomments(v:User): except: abort(400) comments = comments.filter(Comment.created_utc < before) + if not v.can_see_shadowbanned: + comments = comments.join(Comment.author).filter(User.shadowbanned == None) + total = comments.count() comments = sort_objects(sort, comments, Comment) @@ -353,6 +359,9 @@ def searchmessages(v:User): comments = comments.filter(Comment.sentto == sentto.id) + if not v.can_see_shadowbanned: + comments = comments.join(Comment.author).filter(User.shadowbanned == None) + total = comments.count() comments = sort_objects(sort, comments, Comment)