Redirect to /over18 for NSFW links posted in SFW subreddits

Fix a bug where some NSFW links were not prompting the over 18
confirmation. Affects links marked as NSFW but posted to SFW
subreddits
This commit is contained in:
Florence Yeun
2015-04-07 19:45:59 -07:00
parent 1a5931e8ad
commit cdbf61d658

View File

@@ -252,6 +252,10 @@ class FrontController(RedditController):
if not can_view_link_comments(article):
abort(403, 'forbidden')
# check over 18
if article.is_nsfw and not c.over18 and c.render_style == 'html':
return self.intermediate_redirect("/over18", sr_path=False)
# Determine if we should show the embed link for comments
c.can_embed = feature.is_enabled("comment_embeds") and bool(comment)