Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes for frontpage wiki #697

Closed
wants to merge 2 commits into from

3 participants

Andre d Ricky Ramirez Neil Williams
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 4 deletions.
  1. +8 −3 r2/r2/lib/validator/wiki.py
  2. +15 −1 r2/r2/models/subreddit.py
11 r2/r2/lib/validator/wiki.py
View
@@ -108,12 +108,17 @@ def may_revise(sr, user, page=None):
# the user may not edit.
return False
- if not sr.can_submit(user):
+ if not sr.wiki_can_submit(user):
# If the user can not submit to the subreddit
# They should not be able to contribute
return False
-
- karma = max(user.karma('link', sr), user.karma('comment', sr))
+
+ # Use global karma for the frontpage wiki
+ karma_sr = sr if sr.wiki_use_subreddit_karma else None
+
+ # Use link or comment karma, whichever is greater
+ karma = max(user.karma('link', karma_sr), user.karma('comment', karma_sr))
+
if karma < (sr.wiki_edit_karma or 0):
# If the user has too few karma, they should not contribute
return False
16 r2/r2/models/subreddit.py
View
@@ -302,6 +302,10 @@ def flair(self):
def accounts_active(self):
return self.get_accounts_active()[0]
+ @property
+ def wiki_use_subreddit_karma(self):
+ return True
+
def get_accounts_active(self):
fuzzed = False
count = AccountsActiveBySR.get_count(self)
@@ -343,6 +347,9 @@ def can_comment(self, user):
else:
return False
+ def wiki_can_submit(self, user):
+ return self.can_submit(user)
+
def can_submit(self, user, promotion=False):
if c.user_is_admin:
return True
@@ -1104,7 +1111,14 @@ def __init__(self):
self._base = Subreddit._by_name(g.default_sr, stale=True)
except NotFound:
self._base = None
-
+
+ def wiki_can_submit(self, user):
+ return True
+
+ @property
+ def wiki_use_subreddit_karma(self):
+ return False
+
@property
def _should_wiki(self):
return True
Something went wrong with that request. Please try again.