Don't filter NSFW reddits for API clients #526

wants to merge 3 commits into


None yet

3 participants

Deimos commented Sep 12, 2012

No description provided.

bboe commented Oct 1, 2012

How does this pull request interact with #479?

Deimos commented Oct 1, 2012

I don't think there should be any crossover, this is specifically for the subreddit-listing page (/reddits), whereas #479 seems to be related to listings of actual submissions inside subreddits.

@spladug spladug and 1 other commented on an outdated diff Oct 1, 2012
@@ -922,7 +923,9 @@ def query(self):
# don't try to render special subreddits (like promos)
reddits._filter(Subreddit.c.author_id != -1)
- if not c.over18:
+ # Always show NSFW to API users unless obey_over18=true in querystring
+ is_api_client = c.render_style in extensions.API_TYPES
+ if (not is_api_client and not c.over18) or (is_api_client and c.obey_over18):
spladug Oct 1, 2012 Member

In its current form, this appears to always filter out over18 if c.obey_over18 even if c.over18. Instead, it should probably read:

    if not c.over18 and (not is_api_client or c.obey_over18):
Deimos Oct 1, 2012 Contributor

Yeah, I guess it should actually test the thing that it's supposed to be obeying. Yours looks correct, I'll update it.

spladug commented Nov 20, 2012

Due to fixing the bad query, this will no longer work as-is. I'm going to close this pull request. If you'd like to implement this functionality (which sounds good to me) in the keep_fn I'll gladly take a new request. Thanks for all your work on this.

@spladug spladug closed this Nov 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment