Skip to content
Browse files

Messages: keep messages to/from private subreddits

  • Loading branch information...
1 parent 6a62017 commit c918fdc587f531aa3e18864b7667d7355f61d88c @Deimos Deimos committed
Showing with 11 additions and 2 deletions.
  1. +11 −2 r2/r2/models/builder.py
View
13 r2/r2/models/builder.py
@@ -308,12 +308,21 @@ def must_skip(self, item):
"""whether or not to skip any item regardless of whether the builder
was contructed with skip=true"""
user = c.user if c.user_is_loggedin else None
+
if hasattr(item, "promoted") and item.promoted is not None:
return False
+
+ # can_view_slow only exists for Messages, but checking was_comment
+ # is also necessary because items may also be comments that are being
+ # viewed from the inbox page where their render class is overridden.
+ # This check needs to be done before looking at whether they can view
+ # the subreddit, or modmail to/from private subreddits that the user
+ # doesn't have access to will be skipped.
+ if hasattr(item, 'can_view_slow') and not item.was_comment:
+ return not item.can_view_slow()
+
if hasattr(item, 'subreddit') and not item.subreddit.can_view(user):
return True
- if hasattr(item, 'can_view_slow') and not item.can_view_slow():
- return True
class QueryBuilder(Builder):
def __init__(self, query, wrap=Wrapped, keep_fn=None, skip=False,

0 comments on commit c918fdc

Please sign in to comment.
Something went wrong with that request. Please try again.