From ff3632482f7d21eb5d9cd1899f792a6b1dcd566a Mon Sep 17 00:00:00 2001 From: Andre D Date: Tue, 11 Dec 2012 22:22:21 -0500 Subject: [PATCH] wiki: Ensure people who are added to approved wiki may edit. --- r2/r2/controllers/validator/wiki.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/r2/r2/controllers/validator/wiki.py b/r2/r2/controllers/validator/wiki.py index 24336031b..9a9bf932e 100644 --- a/r2/r2/controllers/validator/wiki.py +++ b/r2/r2/controllers/validator/wiki.py @@ -96,16 +96,6 @@ def may_revise(sr, user, page=None): # If the user is an editor on the page, they may edit return True - if sr.wikimode != 'anyone': - # If the user is not a page editor and the mode is not everyone, - # the user may not edit. - return False - - if not sr.can_submit(user): - # If the user can not submit to the subreddit - # They should not be able to contribute - return False - if page and page.special: # If this is a special page # (and the user is not a mod or page editor) @@ -121,6 +111,17 @@ def may_revise(sr, user, page=None): # If the user is a wiki contributor, they may revise return True + if sr.wikimode != 'anyone': + # If the user is not a page editor or wiki contributor, + # and the mode is not everyone, + # the user may not edit. + return False + + if not sr.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)) if karma < (sr.wiki_edit_karma or 0): # If the user has too few karma, they should not contribute