Adjust how and when builder shows reports and big_modbuttons.

Always show big_modbuttons on spamlistings (report listing, mod listing, etc).

Only display reports if ignore_reports is False or the user is admin.
This commit is contained in:
Jason Harvey
2013-02-08 17:33:37 -08:00
parent 8e212ca459
commit 02bd09ae53
2 changed files with 11 additions and 6 deletions

View File

@@ -548,7 +548,9 @@ class FrontController(RedditController, OAuth2ResourceController):
num = num, after = after,
keep_fn = keep_fn,
count = count, reverse = reverse,
wrap = ListingController.builder_wrapper)
wrap = ListingController.builder_wrapper,
spam_listing = True,
)
listing = LinkListing(builder)
pane = listing.listing()

View File

@@ -49,10 +49,11 @@ EXTRA_FACTOR = 1.5
MAX_RECURSION = 10
class Builder(object):
def __init__(self, wrap=Wrapped, keep_fn=None, stale=True):
def __init__(self, wrap=Wrapped, keep_fn=None, stale=True, spam_listing=False):
self.stale = stale
self.wrap = wrap
self.keep_fn = keep_fn
self.spam_listing = spam_listing
def keep_item(self, item):
if self.keep_fn:
@@ -221,7 +222,7 @@ class Builder(object):
w.show_reports = False
w.show_spam = False
w.can_ban = False
w.use_big_modbuttons = False
w.use_big_modbuttons = self.spam_listing
if (c.user_is_admin
or (user
@@ -249,7 +250,8 @@ class Builder(object):
w._spam = False
w.use_big_modbuttons = False
elif getattr(item, 'reported', 0) > 0:
elif (getattr(item, 'reported', 0) > 0
and (not getattr(item, 'ignore_reports', False) or c.user_is_admin)):
w.show_reports = True
w.use_big_modbuttons = True
@@ -280,8 +282,9 @@ class Builder(object):
return True
class QueryBuilder(Builder):
def __init__(self, query, wrap=Wrapped, keep_fn=None, skip=False, **kw):
Builder.__init__(self, wrap=wrap, keep_fn=keep_fn)
def __init__(self, query, wrap=Wrapped, keep_fn=None, skip=False,
spam_listing=False, **kw):
Builder.__init__(self, wrap=wrap, keep_fn=keep_fn, spam_listing=spam_listing)
self.query = query
self.skip = skip
self.num = kw.get('num')