mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-02-19 02:34:20 -05:00
account: Correct can_wiki permissions for trac.
Trac requires None to map to False, where as in new wiki it maps to True
This commit is contained in:
@@ -1228,7 +1228,8 @@ class FormsController(RedditController):
|
||||
returns their user name"""
|
||||
c.response_content_type = 'text/plain'
|
||||
if c.user_is_loggedin:
|
||||
perm = str(c.user.can_wiki())
|
||||
# Change cookie based on can_wiki trac permissions
|
||||
perm = str(c.user.can_wiki(default=False))
|
||||
c.response.content = c.user.name + "," + perm
|
||||
else:
|
||||
c.response.content = ''
|
||||
|
||||
@@ -88,7 +88,7 @@ def may_revise(sr, user, page=None):
|
||||
# Users who are not allowed to view the page may not contribute to the page
|
||||
return False
|
||||
|
||||
if not user.can_wiki():
|
||||
if not user.can_wiki(default=True):
|
||||
# Global wiki contributute ban
|
||||
return False
|
||||
|
||||
|
||||
@@ -182,9 +182,11 @@ class Account(Thing):
|
||||
karma = self.link_karma
|
||||
return max(karma, 1) if karma > -1000 else karma
|
||||
|
||||
def can_wiki(self):
|
||||
def can_wiki(self, default=False):
|
||||
if self.wiki_override is None:
|
||||
return self.link_karma > 100 or self.comment_karma > 100
|
||||
if not default:
|
||||
return self.link_karma > 100 or self.comment_karma > 100
|
||||
return default
|
||||
return self.wiki_override
|
||||
|
||||
def all_karmas(self):
|
||||
|
||||
Reference in New Issue
Block a user