mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 16:58:21 -05:00
Make it possible to hide subscribers on arbitrary subreddits.
This is a generalization of existing code for /r/lounge intended to allow similar hiding for /r/elves.
This commit is contained in:
@@ -232,9 +232,7 @@ class SubredditJsonTemplate(ThingJsonTemplate):
|
||||
)
|
||||
|
||||
def thing_attr(self, thing, attr):
|
||||
# Don't reveal revenue information via /r/lounge's subscribers
|
||||
if (attr == "_ups" and g.lounge_reddit
|
||||
and thing.name == g.lounge_reddit):
|
||||
if attr == "_ups" and thing.hide_subscribers:
|
||||
return 0
|
||||
# Don't return accounts_active counts in /subreddits
|
||||
elif (attr == "accounts_active" and isinstance(c.site, SubSR)):
|
||||
|
||||
@@ -3013,7 +3013,7 @@ class ContributorList(UserList):
|
||||
return _("approved submitters for %(reddit)s") % dict(reddit = c.site.name)
|
||||
|
||||
def user_ids(self):
|
||||
if c.site.name == g.lounge_reddit:
|
||||
if c.site.hide_subscribers:
|
||||
return [] # /r/lounge has too many subscribers to load without timing out,
|
||||
# and besides, some people might not want this list to be so
|
||||
# easily accessible.
|
||||
|
||||
@@ -103,6 +103,7 @@ class Subreddit(Thing, Printable):
|
||||
prev_description_id = "",
|
||||
prev_public_description_id = "",
|
||||
allow_comment_gilding=True,
|
||||
hide_subscribers=False,
|
||||
)
|
||||
_essentials = ('type', 'name', 'lang')
|
||||
_data_int_props = Thing._data_int_props + ('mod_actions', 'reported',
|
||||
@@ -561,9 +562,7 @@ class Subreddit(Thing, Printable):
|
||||
(item.moderator or
|
||||
rels.get((item, user, 'contributor'))))
|
||||
|
||||
# Don't reveal revenue information via /r/lounge's subscribers
|
||||
if (g.lounge_reddit and item.name == g.lounge_reddit
|
||||
and not c.user_is_admin):
|
||||
if item.hide_subscribers and not c.user_is_admin:
|
||||
item._ups = 0
|
||||
|
||||
item.score = item._ups
|
||||
|
||||
Reference in New Issue
Block a user