FIX: only count regular posts in user stats when deleting

This commit is contained in:
Neil Lalonde
2017-11-02 17:11:08 -04:00
parent 30689783db
commit 21dd2ccd43
2 changed files with 17 additions and 2 deletions

View File

@@ -231,8 +231,8 @@ class PostDestroyer
author.user_stat.first_post_created_at = author.posts.order('created_at ASC').first.try(:created_at)
end
unless @topic.nil? && !@post.is_first_post?
author.user_stat.post_count -= 1 # TODO: deleting a regular post
if @post.post_type == Post.types[:regular] && !(@topic.nil? && !@post.is_first_post?)
author.user_stat.post_count -= 1
end
author.user_stat.topic_count -= 1 if @post.is_first_post?