Simplify VSrCanBan.

This commit is contained in:
bsimpson63
2012-10-26 15:46:20 -04:00
parent dff7c87a3c
commit a96995954c
2 changed files with 6 additions and 8 deletions

View File

@@ -1675,11 +1675,11 @@ class ApiController(RedditController, OAuth2ResourceController):
@require_oauth2_scope("modposts")
@noresponse(VUser(), VModhash(),
why = VSrCanBan('id'),
VSrCanBan('id'),
thing = VByName('id'),
spam = VBoolean('spam', default=True))
@api_doc(api_section.moderation)
def POST_remove(self, why, thing, spam):
def POST_remove(self, thing, spam):
# Don't remove a promoted link
if getattr(thing, "promoted", None):
@@ -1714,10 +1714,10 @@ class ApiController(RedditController, OAuth2ResourceController):
@require_oauth2_scope("modposts")
@noresponse(VUser(), VModhash(),
why = VSrCanBan('id'),
VSrCanBan('id'),
thing = VByName('id'))
@api_doc(api_section.moderation)
def POST_approve(self, why, thing):
def POST_approve(self, thing):
if not thing: return
if thing._deleted: return
kw = {'target': thing}

View File

@@ -832,7 +832,7 @@ class VSrCanAlter(VByName):
class VSrCanBan(VByName):
def run(self, thing_name):
if c.user_is_admin:
return 'admin'
return True
elif c.user_is_loggedin:
item = VByName.run(self, thing_name)
# will throw a legitimate 500 if this isn't a link or
@@ -840,9 +840,7 @@ class VSrCanBan(VByName):
# comments
subreddit = item.subreddit_slow
if subreddit.is_moderator(c.user):
return 'mod'
# elif subreddit.is_contributor(c.user):
# return 'contributor'
return True
abort(403,'forbidden')
class VSrSpecial(VByName):