mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 00:38:11 -05:00
Don't allow shame banned domains for promoted links.
This commit is contained in:
committed by
Neil Williams
parent
0d92e51108
commit
47afb5178d
@@ -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)):
|
||||
|
||||
@@ -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")}
|
||||
<div class="infotext rounded">
|
||||
<p>Provide the URL of your ad. <em>No redirects please!</em></p>
|
||||
|
||||
Reference in New Issue
Block a user