Fail cleanly when VSrCanBan called on non Link, Comment, or Message.

This commit is contained in:
Brian Simpson
2014-12-13 11:26:35 -05:00
parent 2f79fe8040
commit 136fa5a359

View File

@@ -1145,12 +1145,10 @@ class VSrCanBan(VByName):
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
# comment, because this should only be used on links and
# comments
subreddit = item.subreddit_slow
if subreddit.is_moderator_with_perms(c.user, 'posts'):
return True
if isinstance(item, (Link, Comment, Message)):
sr = item.subreddit_slow
if sr and sr.is_moderator_with_perms(c.user, 'posts'):
return True
abort(403,'forbidden')
class VSrSpecial(VByName):