]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
Merge branch '1.0.x' into 1.1.x
[quix0rs-gnu-social.git] / lib / noticelist.php
index 3bd7b05b4adb8c446d40d2225f86ef848c78b531..91acbb8d580b6c8bb72b4de58c1f9b9d9a50fe6e 100644 (file)
@@ -87,7 +87,7 @@ class NoticeList extends Widget
                $total   = count($notices);
                $notices = array_slice($notices, 0, NOTICES_PER_PAGE);
                
-       $this->prefill($notices);
+       self::prefill($notices);
        
        foreach ($notices as $notice) {
 
@@ -122,9 +122,31 @@ class NoticeList extends Widget
         return new NoticeListItem($notice, $this->out);
     }
     
-    function prefill(&$notices)
+    static function prefill(&$notices, $avatarSize=AVATAR_STREAM_SIZE)
     {
+        // Prefill attachments
+        Notice::fillAttachments($notices);
+        // Prefill attachments
+        Notice::fillFaves($notices);
+        // Prefill repeat data
+        Notice::fillRepeats($notices);
        // Prefill the profiles
-       Notice::fillProfiles($notices);
+       $profiles = Notice::fillProfiles($notices);
+       // Prefill the avatars
+       Profile::fillAvatars($profiles, $avatarSize);
+       
+       $p = Profile::current();
+       
+       if (!empty($p)) {
+
+            $ids = array();
+       
+            foreach ($notices as $notice) {
+                $ids[] = $notice->id;
+            }
+       
+               Memcached_DataObject::pivotGet('Fave', 'notice_id', $ids, array('user_id' => $p->id));
+               Memcached_DataObject::pivotGet('Notice', 'repeat_of', $ids, array('profile_id' => $p->id));
+       }
     }
 }