From 48e6429f7e32dab69cc5091550ccf3f112b2300a Mon Sep 17 00:00:00 2001 From: Matt Lee Date: Thu, 23 Jul 2015 12:17:20 -0700 Subject: [PATCH] Quarantine: Remove from search results. --- r2/r2/models/builder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/r2/r2/models/builder.py b/r2/r2/models/builder.py index 35f2c729d..e4d8c77a8 100644 --- a/r2/r2/models/builder.py +++ b/r2/r2/models/builder.py @@ -693,14 +693,20 @@ class SearchBuilder(IDBuilder): # doesn't use the default keep_item because we want to keep # things that were voted on, even if they've chosen to hide # them in normal listings + user = c.user if c.user_is_loggedin else None + if item._spam or item._deleted: return False # If checking (wrapped) links, filter out banned subreddits elif hasattr(item, 'subreddit') and item.subreddit.spammy(): return False + elif hasattr(item, 'subreddit') and not item.subreddit.is_exposed(user): + return False elif (self.skip_deleted_authors and getattr(item, "author", None) and item.author._deleted): return False + elif isinstance(item.lookups[0], Subreddit) and not item.is_exposed(user): + return False # show NSFW to API and RSS users unless obey_over18=true is_api_or_rss = (c.render_style in API_TYPES