From 0c762dde42f463f4f45628fed0a29128e4cd37a7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 8 Aug 2011 10:39:45 -0400 Subject: [PATCH] pre-fill all notices in conversations on the page --- lib/threadednoticelist.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index cf3c0b8943..6df4ed99df 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -80,7 +80,7 @@ class ThreadedNoticeList extends NoticeList $total = count($notices); $notices = array_slice($notices, 0, NOTICES_PER_PAGE); - self::prefill($notices); + self::prefill(self::_allNotices($notices)); $conversations = array(); @@ -123,6 +123,21 @@ class ThreadedNoticeList extends NoticeList return $total; } + function _allNotices($notices) + { + $convId = array(); + foreach ($notices as $notice) { + $convId[] = $notice->conversation; + } + $convId = array_unique($convId); + $allMap = Memcached_DataObject::listGet('Notice', 'conversation', $convId); + $allArray = array(); + foreach ($allMap as $convId => $convNotices) { + $allArray = array_merge($allArray, $convNotices); + } + return $allArray; + } + /** * returns a new list item for the current notice *