From 61757fc5fb18a088e5c51d3df9200f76df6ab086 Mon Sep 17 00:00:00 2001
From: Daniel Wehner <daniel.wehner@erdfisch.de>
Date: Tue, 29 Mar 2011 15:43:30 +0200
Subject: [PATCH] #1106096: Update node_comment_statistics when a comment is saved

---
 moderation.pages.inc |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/moderation.pages.inc b/moderation.pages.inc
index 932a30d..4a5df08 100644
--- a/moderation.pages.inc
+++ b/moderation.pages.inc
@@ -98,6 +98,10 @@ function moderation_update_object($obj_id, $obj_type, $attribute, $status) {
         $op = $status ? 'publish' : 'unpublish';
         // Allow modules to respond to the publishing/unpublishing of a comment.
         comment_invoke_comment($comment, $op);
+        // The node comment statistics have to be recalculated.
+        // @TODO: This wouldn't be needed if comment_save would be used for update the values in the database.
+        _comment_update_node_statistics($comment->nid);
       }
       else {
         // Allow modules to respond to the updating other attributes of a comment.
-- 
1.7.1

