]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Cut repeats out of the magic handling
authorBrion Vibber <brion@pobox.com>
Tue, 1 Mar 2011 01:23:01 +0000 (17:23 -0800)
committerBrion Vibber <brion@pobox.com>
Tue, 1 Mar 2011 01:23:01 +0000 (17:23 -0800)
lib/threadednoticelist.php

index 42b85bd132fc98438ead469e9a0ddff677f86020..a3e5f62a590bd5d44f8490d90c0b84d1bc898c1b 100644 (file)
@@ -157,35 +157,37 @@ class ThreadedNoticeListItem extends NoticeListItem
 
     function showEnd()
     {
-        $notice = Notice::conversationStream($this->notice->conversation, 0, self::INITIAL_ITEMS + 2);
-        $notices = array();
-        $cnt = 0;
-        $moreCutoff = null;
-        while ($notice->fetch()) {
-            if ($notice->id == $this->notice->id) {
-                // Skip!
-                continue;
-            }
-            $cnt++;
-            if ($cnt > self::INITIAL_ITEMS) {
-                // boo-yah
-                $moreCutoff = clone($notice);
-                break;
+        if (!$this->repeat) {
+            $notice = Notice::conversationStream($this->notice->conversation, 0, self::INITIAL_ITEMS + 2);
+            $notices = array();
+            $cnt = 0;
+            $moreCutoff = null;
+            while ($notice->fetch()) {
+                if ($notice->id == $this->notice->id) {
+                    // Skip!
+                    continue;
+                }
+                $cnt++;
+                if ($cnt > self::INITIAL_ITEMS) {
+                    // boo-yah
+                    $moreCutoff = clone($notice);
+                    break;
+                }
+                $notices[] = clone($notice); // *grumble* inefficient as hell
             }
-            $notices[] = clone($notice); // *grumble* inefficient as hell
-        }
 
-        if ($notices) {
-            $this->out->elementStart('ul', 'notices threaded-notices xoxo');
-            if ($moreCutoff) {
-                $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
-                $item->show();
-            }
-            foreach (array_reverse($notices) as $notice) {
-                $item = new ThreadedNoticeListSubItem($notice, $this->out);
-                $item->show();
+            if ($notices) {
+                $this->out->elementStart('ul', 'notices threaded-notices xoxo');
+                if ($moreCutoff) {
+                    $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
+                    $item->show();
+                }
+                foreach (array_reverse($notices) as $notice) {
+                    $item = new ThreadedNoticeListSubItem($notice, $this->out);
+                    $item->show();
+                }
+                $this->out->elementEnd('ul');
             }
-            $this->out->elementEnd('ul');
         }
 
         parent::showEnd();