diff --git a/.gitignore b/.gitignore index 06376b6e7..276f7bb0c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ r2/r2/public/static/vote.js r2/r2/public/static/reddit_rtl.css r2/data/* r2/count.pickle +r2/srcount.pickle r2/myproduction.ini .DS_Store r2/r2.egg-info/** diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index c16303249..2710f60a0 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -502,6 +502,10 @@ class ApiController(RedditController): sr = thing.subreddit_slow expire_hot(sr) + #comments have special delete tasks + elif isinstance(thing, Comment): + thing._delete() + @Json @validate(VUser(), VModhash(), diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index aa5e6cce7..7c57606d8 100644 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -258,7 +258,8 @@ class Comment(Thing, Printable): pass def _delete(self): - pass + link = Link._byID(self.link_id, data = True) + link._incr('num_comments', -1) @classmethod def _new(cls, author, link, parent, body, ip, spam = False): diff --git a/r2/r2/templates/comment.html b/r2/r2/templates/comment.html index e1eebf1e8..29c7f86c3 100644 --- a/r2/r2/templates/comment.html +++ b/r2/r2/templates/comment.html @@ -1,4 +1,4 @@ -## "The contents of this file are subject to the Common Public Attribution +## The contents of this file are subject to the Common Public Attribution ## License Version 1.0. (the "License"); you may not use this file except in ## compliance with the License. You may obtain a copy of the License at ## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public