Make use of the new API for the conversation feed (#192)
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / files / lib / data / conversation / UserConversationList.class.php
index 305250a2e4d17a62a67b77c5be84c1be5be5de75..8a759ad504c9370410fd54919943be1f42a0bb93 100644 (file)
@@ -4,6 +4,7 @@ namespace wcf\data\conversation;
 
 use wcf\data\conversation\label\ConversationLabel;
 use wcf\data\conversation\label\ConversationLabelList;
+use wcf\system\cache\runtime\ConversationMessageRuntimeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\WCF;
@@ -216,7 +217,7 @@ class UserConversationList extends ConversationList
 
             $labels = $this->loadLabelAssignments();
 
-            $userIDs = [];
+            $userIDs = $messageIDs = [];
             foreach ($this->objects as $conversationID => $conversation) {
                 if (isset($labels[$conversationID])) {
                     foreach ($labels[$conversationID] as $label) {
@@ -230,11 +231,18 @@ class UserConversationList extends ConversationList
                 if ($conversation->lastPosterID) {
                     $userIDs[] = $conversation->lastPosterID;
                 }
+
+                if ($conversation->firstMessageID) {
+                    $messageIDs[] = $conversation->firstMessageID;
+                }
             }
 
-            if (!empty($userIDs)) {
+            if ($userIDs !== []) {
                 UserProfileRuntimeCache::getInstance()->cacheObjectIDs($userIDs);
             }
+            if ($messageIDs !== []) {
+                ConversationMessageRuntimeCache::getInstance()->cacheObjectIDs($userIDs);
+            }
         }
     }