From 19395afbd78c3a15b71bb4f4e85ce144352cf768 Mon Sep 17 00:00:00 2001 From: Chad Birch Date: Mon, 29 Jul 2013 21:58:39 -0600 Subject: [PATCH] exclude_banned_modqueue: apply to unmoderated as well --- r2/r2/controllers/front.py | 3 +++ r2/r2/lib/db/queries.py | 3 ++- r2/r2/templates/createsubreddit.html | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 77e144667..271f28b8a 100755 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -568,6 +568,9 @@ class FrontController(RedditController, OAuth2ResourceController): return True # spam, unless banned by a moderator return False elif location == "unmoderated": + # banned user, don't show if subreddit pref excludes + if x.author._spam and x.subreddit.exclude_banned_modqueue: + return False return not getattr(x, 'verdict', None) else: raise ValueError diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py index 0dc137105..2a1cbac0d 100755 --- a/r2/r2/lib/db/queries.py +++ b/r2/r2/lib/db/queries.py @@ -840,7 +840,8 @@ def new_link(link): with CachedQueryMutator() as m: if link._spam: m.insert(get_spam_links(sr), [link]) - m.insert(get_unmoderated_links(sr), [link]) + if not (sr.exclude_banned_modqueue and author._spam): + m.insert(get_unmoderated_links(sr), [link]) add_queries(results, insert_items = link) amqp.add_item('new_link', link._fullname) diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 4135e59a4..1c997ceda 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -261,7 +261,7 @@ %endif >