mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
Make /r/lounge is_contributor not rely on overbloated rel.
The lounge is too popular! update_gold_users is crashing taking too long to update the SRMember:contributor rel when users' gold expire. This change makes it so that we don't actually need to maintain the rel to maintain proper access control for the lounge.
This commit is contained in:
@@ -178,10 +178,6 @@ class AdminTools(object):
|
||||
|
||||
account.friend_rels_cache(_update=True)
|
||||
|
||||
if g.lounge_reddit:
|
||||
sr = Subreddit._by_name(g.lounge_reddit)
|
||||
sr.add_contributor(account)
|
||||
|
||||
def degolden(self, account, severe=False):
|
||||
|
||||
if severe:
|
||||
@@ -192,10 +188,6 @@ class AdminTools(object):
|
||||
account.gold = False
|
||||
account._commit()
|
||||
|
||||
if g.lounge_reddit and not getattr(account, "gold_charter", False):
|
||||
sr = Subreddit._by_name(g.lounge_reddit)
|
||||
sr.remove_contributor(account)
|
||||
|
||||
def admin_list(self):
|
||||
return list(g.admins)
|
||||
|
||||
|
||||
@@ -312,6 +312,12 @@ class Subreddit(Thing, Printable):
|
||||
def spammy(self):
|
||||
return self._spam
|
||||
|
||||
def is_contributor(self, user):
|
||||
if self.name.lower() == g.lounge_reddit.lower():
|
||||
return user.gold or user.gold_charter
|
||||
else:
|
||||
return super(Subreddit, self).is_contributor(user)
|
||||
|
||||
def can_comment(self, user):
|
||||
if c.user_is_admin:
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user