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:
Neil Williams
2012-12-26 20:49:09 -08:00
parent 55a4968209
commit dda3ff1539
2 changed files with 6 additions and 8 deletions

View File

@@ -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)

View File

@@ -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