From bbd1ec7e33d1d52b3100184ae29f534b0b729b16 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@kodamera.se>
Date: Thu, 24 Mar 2011 08:45:50 +0100
Subject: [PATCH] Issue [#1077880] - Block of issue counts on project pages is not invalidated when it should be.

---
 includes/comment.inc         |    5 +++--
 includes/issue_node_form.inc |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/includes/comment.inc b/includes/comment.inc
index 493358e..52d123e 100644
--- a/includes/comment.inc
+++ b/includes/comment.inc
@@ -109,8 +109,9 @@ function project_issue_comment(&$arg, $op) {
   // If there are any affected projects, invalidate the block cache for those.
   if (!empty($affected_projects)) {
     foreach ($affected_projects as $pid => $value) {
-      $cid = 'project_issue_cockpit_block:'. $pid;
-      cache_clear_all($cid, 'cache');
+      // Block could be cached for different permissions, try both.
+      cache_clear_all('project_issue_cockpit_block:0'. $pid, 'cache');
+      cache_clear_all('project_issue_cockpit_block:1'. $pid, 'cache');
     }
   }
 }
diff --git a/includes/issue_node_form.inc b/includes/issue_node_form.inc
index a0fa9bf..167164e 100644
--- a/includes/issue_node_form.inc
+++ b/includes/issue_node_form.inc
@@ -484,5 +484,7 @@ function _project_issue_insert($node) {
 
   // Invalidate the "Issue cockpit" block cache for this project, since the
   // new issue will have altered the summary totals.
-  cache_clear_all('project_issue_cockpit_block:'. $node->pid, 'cache');
+  // Block could be cached for different permissions, try both.
+  cache_clear_all('project_issue_cockpit_block:0'. $node->pid, 'cache');
+  cache_clear_all('project_issue_cockpit_block:1'. $node->pid, 'cache');
 }
-- 
1.7.3.3

