From c82bcfd1a336cf34c3b0eebc92c970b2aa3fb67f Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 28 Jun 2019 01:23:43 +1200 Subject: [PATCH] Remove cached smart group entries when removing from a group In 5.15 we have added fixes for smart groups regarding removed entries. Possibly related to this but also possibly pre-existing I'm seeing contacts who have been removed from smart groups showing up after removal in search results for the duration of the smart group cache. Regardless the fix feels safe, sensible and correct so I'm comfortable targetting the rc without further research as to whether it is a regression. The fix being removal of the cache entry when the group entry is removed. --- CRM/Contact/BAO/GroupContact.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 141b0ffeb2..2e1dbd503b 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -239,6 +239,8 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact { CRM_Contact_BAO_SubscriptionHistory::create($historyParams); $groupContact->status = $status; $groupContact->save(); + // Remove any rows from the group contact cache so it disappears straight away from smart groups. + CRM_Contact_BAO_GroupContactCache::removeContact($contactId, $groupId); } } -- 2.25.1