fix comment rate limiter.

This commit is contained in:
Christopher Slowe
2009-07-09 22:08:43 -07:00
parent c034fe485b
commit a0c129b8a0
2 changed files with 5 additions and 3 deletions

View File

@@ -596,11 +596,12 @@ class ApiController(RedditController):
#remove the ratelimit error if the user's karma is high
if not should_ratelimit:
c.errors.remove(errors.RATELIMIT)
c.errors.remove((errors.RATELIMIT, 'ratelimit'))
if (not commentform.has_errors("text",
errors.NO_TEXT,
errors.TOO_LONG,
errors.TOO_LONG) and
not commentform.has_errors("ratelimit",
errors.RATELIMIT) and
not commentform.has_errors("parent",
errors.DELETED_COMMENT)):
@@ -676,7 +677,7 @@ class ApiController(RedditController):
sr = thing.subreddit_slow
should_ratelimit = sr.should_ratelimit(c.user, 'link')
if not should_ratelimit:
c.errors.remove(errors.RATELIMIT)
c.errors.remove((errors.RATELIMIT, 'ratelimit'))
# share_from and messages share a too_long error.
# finding an error on one necessitates hiding the other error

View File

@@ -70,6 +70,7 @@
style = "" if thing.creating else "display: none")}
${error_field("TOO_LONG", "text", "span")}
${error_field("RATELIMIT", "ratelimit", "span")}
${error_field("NO_TEXT", "text", "span")}
<div class="usertext-buttons">