From af0dbe5b66f19f00700786f62e20fa88efd56ca0 Mon Sep 17 00:00:00 2001 From: Keith Mitchell Date: Thu, 12 Jul 2012 16:48:28 -0700 Subject: [PATCH] Don't show NSFW links in the related tab unless the Link is marked NSFW --- r2/r2/controllers/front.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 6db0b93c3..2c474ae73 100755 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -670,7 +670,8 @@ class FrontController(RedditController): rel_range = timedelta(days=3) start = (article._date - rel_range).strftime("%s") end = (article._date + rel_range).strftime("%s") - query = "(and %s timestamp:%s..%s)" % (query, start, end) + nsfw = "nsfw:0" if not (article.over_18 or article._nsfw.findall(article.title)) else "" + query = "(and %s timestamp:%s..%s %s)" % (query, start, end, nsfw) q = SearchQuery(query, raw_sort="-text_relevance", syntax="cloudsearch") pane = self._search(q, num=num, after=after, reverse=reverse,