Permalink
Browse files

Add stats events for spam-related stuff.

  • Loading branch information...
1 parent 8da619d commit c215726f6e62904762a70802601aaac65a11dfad @spladug spladug committed Jun 25, 2012
Showing with 12 additions and 2 deletions.
  1. +4 −2 r2/r2/controllers/api.py
  2. +8 −0 r2/r2/models/link.py
View
@@ -253,9 +253,10 @@ def POST_submit(self, form, jquery, url, selftext, kind, title,
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 @@ def POST_submit(self, form, jquery, url, selftext, kind, title,
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
@@ -132,6 +132,7 @@ def _submit(cls, title, url, author, sr, ip, spam=False):
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 @@ def _new(cls, author, link, parent, body, ip):
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 @@ def _new(cls, author, to, subject, body, ip, parent=None, sr=None,
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):

0 comments on commit c215726

Please sign in to comment.