Remove leave message caused by invisible participants
authorAlexander Ebert <ebert@woltlab.com>
Wed, 15 Nov 2017 16:47:31 +0000 (17:47 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 15 Nov 2017 16:47:31 +0000 (17:47 +0100)
files/lib/page/ConversationPage.class.php

index b23f7e5c787659b407f6ba98546644774c7ccfab..84802ad427d7cfece5a19f5a34315d91ddb6bc70 100644 (file)
@@ -224,9 +224,24 @@ class ConversationPage extends MultipleLinkPage {
                }
                $this->objectList->rewind();
                
+               // get invisible participants
+               $invisibleParticipantIDs = [];
+               if (WCF::getUser()->userID != $this->conversation->userID) {
+                       foreach ($this->participantList as $participant) {
+                               if ($participant->isInvisible) {
+                                       $invisibleParticipantIDs[] = $participant->userID;
+                               }
+                       }
+               }
+               
                // load modification log entries
                $this->modificationLogList = new ConversationLogModificationLogList($this->conversation->conversationID);
                $this->modificationLogList->getConditionBuilder()->add("modification_log.time BETWEEN ? AND ?", [$startTime, $endTime]);
+               
+               if (!empty($invisibleParticipantIDs)) {
+                       $this->modificationLogList->getConditionBuilder()->add("(modification_log.action <> ? OR modification_log.userID NOT IN (?))", ['leave', $invisibleParticipantIDs]);
+               }
+               
                $this->modificationLogList->readObjects();
        }