From 19be2d267dcdfdd83ec355f291160d6fbc578b0a Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Tue, 17 Dec 2013 15:56:04 -0500 Subject: [PATCH] Only sponsors can unmarknsfw on promoted links. --- r2/r2/controllers/api.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index ae7f4ea19..6203b3545 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1148,13 +1148,16 @@ class ApiController(RedditController, OAuth2ResourceController): See also: [/api/marknsfw](#POST_api_marknsfw). """ + + if promote.is_promo(thing): + if c.user_is_sponsor: + # set the override attribute so this link won't be automatically + # reset as nsfw by promote.make_daily_promotions + thing.over_18_override = True + else: + abort(403,'forbidden') + thing.over_18 = False - - if c.user_is_sponsor and promote.is_promo(thing): - # set the override attribute so this link won't be automatically - # reset as nsfw by promote.make_daily_promotions - thing.over_18_override = True - thing._commit() if c.user._id != thing.author_id: