]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelist.php
Fix display of group admin avatars
[quix0rs-gnu-social.git] / lib / noticelist.php
index aaa3b3c98691e8eb127683bdaa1179e1d728088c..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,10 +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
        $profiles = Notice::fillProfiles($notices);
-       Profile::fillAvatars($profiles, AVATAR_STREAM_SIZE);
+       // 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));
+       }
     }
 }