Add stats events for spam-related stuff.

This commit is contained in:
Neil Williams
2012-06-25 10:39:43 -07:00
parent 8da619dc1f
commit c215726f6e
2 changed files with 12 additions and 2 deletions

View File

@@ -253,9 +253,10 @@ class ApiController(RedditController):
check_domain = True
# check for no url, or clear that error field on return
if form.has_errors("url", errors.NO_URL, errors.BAD_URL,
errors.DOMAIN_BANNED):
if form.has_errors("url", errors.NO_URL, errors.BAD_URL):
pass
elif form.has_errors("url", errors.DOMAIN_BANNED):
g.stats.simple_event('spam.shame.link')
elif form.has_errors("url", errors.ALREADY_SUB):
check_domain = False
u = url[0].already_submitted_link
@@ -316,6 +317,7 @@ class ApiController(RedditController):
c.user, sr, ip, spam=c.user._spam)
if banmsg:
g.stats.simple_event('spam.domainban.link_url')
admintools.spam(l, banner = "domain (%s)" % banmsg)
if kind == 'self':

View File

@@ -132,6 +132,7 @@ class Link(Thing, Printable):
l._commit()
l.set_url_cache()
if author._spam:
g.stats.simple_event('spam.autoremove.link')
admintools.spam(l, banner='banned user')
return l
@@ -645,6 +646,9 @@ class Comment(Thing, Printable):
c._spam = author._spam
if author._spam:
g.stats.simple_event('spam.autoremove.comment')
#these props aren't relations
if parent:
c.parent_id = parent._id
@@ -992,6 +996,10 @@ class Message(Thing, Printable):
m = Message(subject=subject, body=body, author_id=author._id, new=True,
ip=ip, from_sr=from_sr)
m._spam = author._spam
if author._spam:
g.stats.simple_event('spam.autoremove.message')
sr_id = None
# check to see if the recipient is a subreddit and swap args accordingly
if to and isinstance(to, Subreddit):