mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
* add nofollow to comment titles on low point (or banned) comments or links.
* have submissions to banned reddits generate an error message on /submit. * make unicode user name pages 404 rather than 500
This commit is contained in:
@@ -169,6 +169,7 @@ class ApiController(RedditController):
|
||||
return
|
||||
|
||||
if form.has_errors('sr', errors.SUBREDDIT_NOEXIST,
|
||||
errors.SUBREDDIT_NOTALLOWED,
|
||||
errors.SUBREDDIT_REQUIRED):
|
||||
# checking to get the error set in the form, but we can't
|
||||
# check for rate-limiting if there's no subreddit
|
||||
@@ -1344,7 +1345,8 @@ class ApiController(RedditController):
|
||||
form.has_errors('url', errors.NO_URL, errors.ALREADY_SUB) ):
|
||||
#if url == l.url, we're just editting something else
|
||||
pass
|
||||
elif form.has_errors('sr', errors.SUBREDDIT_NOEXIST):
|
||||
elif form.has_errors('sr', errors.SUBREDDIT_NOEXIST,
|
||||
errors.SUBREDDIT_NOTALLOWED):
|
||||
pass
|
||||
elif (expire == 'expirein' and
|
||||
form.has_errors('timelimitlength', errors.BAD_NUMBER)):
|
||||
|
||||
@@ -49,6 +49,7 @@ error_list = dict((
|
||||
('ALREADY_SUB', _("that link has already been submitted")),
|
||||
('SUBREDDIT_EXISTS', _('that reddit already exists')),
|
||||
('SUBREDDIT_NOEXIST', _('that reddit doesn\'t exist')),
|
||||
('SUBREDDIT_NOTALLOWED', _("you aren't allowed to post there.")),
|
||||
('SUBREDDIT_REQUIRED', _('you must specify a reddit')),
|
||||
('BAD_SR_NAME', _('that name isn\'t going to work')),
|
||||
('RATELIMIT', _('you are trying to submit too fast. try again in %(time)s.')),
|
||||
|
||||
@@ -500,7 +500,7 @@ class VSubmitSR(Validator):
|
||||
return None
|
||||
|
||||
if sr and not (c.user_is_loggedin and sr.can_submit(c.user)):
|
||||
abort(403, "forbidden")
|
||||
self.set_error(errors.SUBREDDIT_NOTALLOWED)
|
||||
else:
|
||||
return sr
|
||||
|
||||
@@ -599,6 +599,9 @@ class VExistingUname(VRequired):
|
||||
VRequired.__init__(self, item, errors.NO_USER, *a, **kw)
|
||||
|
||||
def run(self, name):
|
||||
# make sure the name satisfies our user name regexp before
|
||||
# bothering to look it up.
|
||||
name = chkuser(name)
|
||||
if name:
|
||||
try:
|
||||
return Account._by_name(name)
|
||||
|
||||
@@ -529,6 +529,13 @@ class Comment(Thing, Printable):
|
||||
item.profilepage = c.profilepage
|
||||
item.link = links.get(item.link_id)
|
||||
|
||||
if (item.link._score <= 1 or item.score < 3 or
|
||||
item.link._spam or item._spam or item.author._spam):
|
||||
|
||||
item.nofollow = True
|
||||
else:
|
||||
item.nofollow = False
|
||||
|
||||
if not hasattr(item, 'subreddit'):
|
||||
item.subreddit = item.subreddit_slow
|
||||
if not hasattr(item, 'target'):
|
||||
@@ -573,8 +580,6 @@ class Comment(Thing, Printable):
|
||||
|
||||
item.editted = getattr(item, "editted", False)
|
||||
|
||||
#score less than 3, nofollow the links
|
||||
item.nofollow = item._score < 3
|
||||
|
||||
#will get updated in builder
|
||||
item.num_children = 0
|
||||
|
||||
@@ -1456,6 +1456,9 @@ textarea.gray { color: gray; }
|
||||
-moz-outline: none;
|
||||
}
|
||||
|
||||
.toolbar .likes .score.likes {display: inline-block;}
|
||||
.toolbar .dislikes .score.dislikes {display: inline-block;}
|
||||
|
||||
.toolbar a, .toolbar .clickable {
|
||||
cursor: pointer;
|
||||
color: #336699;
|
||||
|
||||
@@ -40,7 +40,11 @@ ${parent.midcol(not thing.collapsed, cls = cls)}
|
||||
%if c.profilepage:
|
||||
%if thing.link:
|
||||
%if thing.link.title:
|
||||
<a href="${thing.link.url}" class="title">
|
||||
<a href="${thing.link.url}" class="title"
|
||||
%if thing.nofollow:
|
||||
rel="nofollow"
|
||||
%endif
|
||||
>
|
||||
${thing.link.title}
|
||||
</a>
|
||||
%else:
|
||||
|
||||
@@ -93,6 +93,7 @@ ${thing.formtabs_menu}
|
||||
reddit.sr_cache = ${unsafe(thing.sr_searches)};
|
||||
</script>
|
||||
${error_field("SUBREDDIT_NOEXIST", "sr", "div")}
|
||||
${error_field("SUBREDDIT_NOTALLOWED", "sr", "div")}
|
||||
${error_field("SUBREDDIT_REQUIRED", "sr", "div")}
|
||||
|
||||
<div id="suggested-reddits">
|
||||
|
||||
Reference in New Issue
Block a user