votingapi_set_votes() does not trigger cache recalculation when the first param is empty

tuffnatty - September 23, 2009 - 11:39
Project:Voting API
Version:6.x-2.3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:patch (to be ported)
Description

votingapi_set_votes() does not trigger cache recalculation when the first param is empty, that is, votes are _only_ deleted, not added.
Here is a patch.

--- votingapi.module.orig       2009-07-08 20:09:45.000000000 +0400
+++ votingapi.module    2009-09-23 15:28:30.000000000 +0400
@@ -143,7 +143,11 @@
       $criteria = array($criteria);
     }
     foreach ($criteria as $c) {
-      votingapi_delete_votes(votingapi_select_votes($c));
+      $votes_deleted = votingapi_select_votes($c);
+      foreach ($votes_deleted as $vote) {
+        $touched[$vote['content_type']][$vote['content_id']] = TRUE;
+      }
+      votingapi_delete_votes($votes_deleted);
     }
   }

 
 

Drupal is a registered trademark of Dries Buytaert.