mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: post counts in user stats when changing post owner
This commit is contained in:
@@ -290,9 +290,11 @@ class PostRevisor
|
||||
private_message = @post.topic.private_message?
|
||||
|
||||
prev_owner_user_stat = prev_owner.user_stat
|
||||
prev_owner_user_stat.post_count -= 1
|
||||
prev_owner_user_stat.topic_count -= 1 if @post.is_first_post?
|
||||
prev_owner_user_stat.likes_received -= likes if !private_message
|
||||
unless private_message
|
||||
prev_owner_user_stat.post_count -= 1 if @post.post_type == Post.types[:regular]
|
||||
prev_owner_user_stat.topic_count -= 1 if @post.is_first_post?
|
||||
prev_owner_user_stat.likes_received -= likes
|
||||
end
|
||||
prev_owner_user_stat.update_topic_reply_count
|
||||
|
||||
if @post.created_at == prev_owner.user_stat.first_post_created_at
|
||||
@@ -302,9 +304,11 @@ class PostRevisor
|
||||
prev_owner_user_stat.save!
|
||||
|
||||
new_owner_user_stat = new_owner.user_stat
|
||||
new_owner_user_stat.post_count += 1
|
||||
new_owner_user_stat.topic_count += 1 if @post.is_first_post?
|
||||
new_owner_user_stat.likes_received += likes if !private_message
|
||||
unless private_message
|
||||
new_owner_user_stat.post_count += 1 if @post.post_type == Post.types[:regular]
|
||||
new_owner_user_stat.topic_count += 1 if @post.is_first_post?
|
||||
new_owner_user_stat.likes_received += likes
|
||||
end
|
||||
new_owner_user_stat.update_topic_reply_count
|
||||
new_owner_user_stat.save!
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user