Don't show NSFW links in the related tab unless the Link is marked NSFW

This commit is contained in:
Keith Mitchell
2012-07-12 16:48:28 -07:00
committed by Neil Williams
parent 45d86810d8
commit af0dbe5b66

View File

@@ -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,