diff --git a/lib/post_destroyer.rb b/lib/post_destroyer.rb
index 617cc7749a2..7336e981b64 100644
--- a/lib/post_destroyer.rb
+++ b/lib/post_destroyer.rb
@@ -133,7 +133,6 @@ class PostDestroyer
         Topic.reset_highest(@post.topic_id)
       end
       trash_public_post_actions
-      agree_with_flags
       trash_user_actions
       @post.update_flagged_posts_count
       remove_associated_replies
@@ -147,6 +146,9 @@ class PostDestroyer
       update_associated_category_latest_topic
       update_user_counts
       TopicUser.update_post_action_cache(post_id: @post.id)
+      DB.after_commit do
+        agree_with_flags
+      end
     end
 
     feature_users_in_the_topic if @post.topic