$total = count($notices);
$notices = array_slice($notices, 0, NOTICES_PER_PAGE);
- $this->prefill($notices);
+ self::prefill($notices);
foreach ($notices as $notice) {
return new NoticeListItem($notice, $this->out);
}
- function prefill(&$notices)
+ static function prefill(&$notices, $avatarSize=AVATAR_STREAM_SIZE)
{
// Prefill the profiles
$profiles = Notice::fillProfiles($notices);
- Profile::fillAvatars($profiles, AVATAR_STREAM_SIZE);
+ // Prefill the avatars
+ Profile::fillAvatars($profiles, $avatarSize);
+
+ $p = Profile::current();
+
+ $ids = array();
+
+ foreach ($notices as $notice) {
+ $ids[] = $notice->id;
+ }
+
+ if (!empty($p)) {
+ Memcached_DataObject::pivotGet('Fave', 'notice_id', $ids, array('user_id' => $p->id));
+ }
}
}
$total = count($notices);
$notices = array_slice($notices, 0, NOTICES_PER_PAGE);
- $this->prefill($notices);
+ self::prefill($notices);
$conversations = array();
$item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out, count($notices));
$item->show();
}
- // XXX: replicating NoticeList::prefill(), annoyingly
- $this->prefill($notices);
+ NoticeList::prefill($notices, AVATAR_MINI_SIZE);
foreach (array_reverse($notices) as $notice) {
if (Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice))) {
$item = new ThreadedNoticeListSubItem($notice, $this->notice, $this->out);
parent::showEnd();
}
-
- function prefill(&$notices)
- {
- // Prefill the profiles
- $profiles = Notice::fillProfiles($notices);
- Profile::fillAvatars($profiles, AVATAR_MINI_SIZE);
- }
}
// @todo FIXME: needs documentation.