Skip to content
Browse files

Make API banned_by / approved_by mutually exclusive.

This also fixes an API bug where banned_by was always true if you don't
have moderator permission for a thing.
  • Loading branch information...
1 parent 0a0d3fe commit fcedf701ee1587e4de153b983ae9cca5ea5d7451 @chromakode chromakode committed Jan 16, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 r2/r2/lib/
7 r2/r2/lib/
@@ -191,9 +191,12 @@ def thing_attr(self, thing, attr):
return thing.reported
ban_info = getattr(thing, "ban_info", {})
if attr == "banned_by":
- return ban_info.get("banner") if ban_info.get('moderator_banned') else True
+ banner = (ban_info.get("banner")
+ if ban_info.get('moderator_banned')
+ else True)
+ return banner if thing._spam else None
elif attr == "approved_by":
- return ban_info.get("unbanner")
+ return ban_info.get("unbanner") if not thing._spam else None
return getattr(thing, attr, None)

0 comments on commit fcedf70

Please sign in to comment.
Something went wrong with that request. Please try again.