Browse files

Multireddits should not exclude over18 subreddits for users with the …

…over18 cookie
  • Loading branch information...
1 parent 3699db9 commit a61fbb2e4dd0a8c487460d7dea9af9f81c45f396 @andre-d andre-d committed with Logan Hanks Feb 7, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 r2/r2/models/link.py
View
8 r2/r2/models/link.py
@@ -35,6 +35,7 @@
from mako.filters import url_escape
from r2.lib.strings import strings, Score
from r2.lib.db import tdb_cassandra
+from r2.models.subreddit import MultiReddit
from pylons import c, g, request
from pylons.i18n import ungettext, _
@@ -217,9 +218,10 @@ def keep_item(self, wrapped):
return False
# hide NSFW links from non-logged users and under 18 logged users
- # if they're not explicitly visiting an NSFW subreddit
- if ((not c.user_is_loggedin and c.site != wrapped.subreddit)
- or (c.user_is_loggedin and not c.over18)):
+ # if they're not explicitly visiting an NSFW subreddit or a multireddit
+ if (((not c.user_is_loggedin and c.site != wrapped.subreddit)
+ or (c.user_is_loggedin and not c.over18))
+ and not (isinstance(c.site, MultiReddit) and c.over18)):
is_nsfw = bool(wrapped.over_18)
is_from_nsfw_sr = bool(wrapped.subreddit.over_18)

0 comments on commit a61fbb2

Please sign in to comment.