Add missing participant counter update in hideConversation()
authorMatthias Schmidt <gravatronics@live.com>
Sun, 26 Oct 2014 21:11:21 +0000 (22:11 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 26 Oct 2014 21:11:21 +0000 (22:11 +0100)
files/lib/data/conversation/ConversationAction.class.php
files/lib/data/conversation/ConversationEditor.class.php

index 6873a27d0d0627986bd163d63029f9f92ed71eb2..e96ef23a77684964b7130386644b30f9fa30e820 100644 (file)
@@ -576,7 +576,8 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                $this->unmarkItems();
                
                if ($this->parameters['hideConversation'] == Conversation::STATE_LEFT) {
-                       // update participant summary
+                       // update participants count and participant summary
+                       ConversationEditor::updateParticipantCounts($this->objectIDs);
                        ConversationEditor::updateParticipantSummaries($this->objectIDs);
                        
                        // delete conversation if all users have left it
index 52f9a855cb6f77ce5e9f118b89eea6884a107c32..df3b9f12b60eacc5be08757062d539a16ea3e584 100644 (file)
@@ -236,4 +236,20 @@ class ConversationEditor extends DatabaseObjectEditor {
                        $editor->updateParticipantSummary();
                }
        }
+       
+       /**
+        * Updates the participant counts of the given conversations.
+        * 
+        * @param       array<integer>          $conversationIDs
+        */
+       public static function updateParticipantCounts(array $conversationIDs) {
+               $conversationList = new ConversationList();
+               $conversationList->getConditionBuilder()->add('conversation.conversationID IN (?)', array($conversationIDs));
+               $conversationList->readObjects();
+               
+               foreach ($conversationList as $conversation) {
+                       $editor = new ConversationEditor($conversation);
+                       $editor->updateParticipantCount();
+               }
+       }
 }