mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 07:19:25 -05:00
Simplify VSrCanBan.
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user