diff --git a/r2/r2/controllers/promotecontroller.py b/r2/r2/controllers/promotecontroller.py index 0f50e7efb..202f55501 100644 --- a/r2/r2/controllers/promotecontroller.py +++ b/r2/r2/controllers/promotecontroller.py @@ -76,6 +76,7 @@ from r2.lib.validator import ( VOneOf, VPromoCampaign, VRatelimit, + VShamedDomain, VSponsor, VSponsorAdmin, VSponsorAdminOrAdminSecret, @@ -355,6 +356,7 @@ class PromoteController(ListingController): VRatelimit(rate_user=True, rate_ip=True, prefix='create_promo_'), + VShamedDomain('url'), l=VLink('link_id'), title=VTitle('title'), url=VUrl('url', allow_self=False, lookup=False), @@ -390,6 +392,11 @@ class PromoteController(ListingController): if not should_ratelimit: c.errors.remove((errors.RATELIMIT, 'ratelimit')) + # check for shame banned domains + if form.has_errors("url", errors.DOMAIN_BANNED): + g.stats.simple_event('spam.shame.link') + return + # demangle URL in canonical way if url: if isinstance(url, (unicode, str)): diff --git a/r2/r2/templates/promotelinkform.html b/r2/r2/templates/promotelinkform.html index 24dc67907..7d9e360ac 100644 --- a/r2/r2/templates/promotelinkform.html +++ b/r2/r2/templates/promotelinkform.html @@ -282,6 +282,7 @@ ${self.javascript_setup()} value="${('self' if thing.link.is_self else thing.link.url) if thing.link else ""}" class="rounded"/> ${error_field("NO_URL", "url", "div")} ${error_field("BAD_URL", "url", "div")} + ${error_field("DOMAIN_BANNED", "url", "div")} ${error_field("ALREADY_SUB", "url", "div")}

Provide the URL of your ad. No redirects please!