We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 082ddf36 authored by Brion Vibber's avatar Brion Vibber

Cut repeats out of the magic handling

parent 407cc851
...@@ -157,35 +157,37 @@ class ThreadedNoticeListItem extends NoticeListItem ...@@ -157,35 +157,37 @@ class ThreadedNoticeListItem extends NoticeListItem
function showEnd() function showEnd()
{ {
$notice = Notice::conversationStream($this->notice->conversation, 0, self::INITIAL_ITEMS + 2); if (!$this->repeat) {
$notices = array(); $notice = Notice::conversationStream($this->notice->conversation, 0, self::INITIAL_ITEMS + 2);
$cnt = 0; $notices = array();
$moreCutoff = null; $cnt = 0;
while ($notice->fetch()) { $moreCutoff = null;
if ($notice->id == $this->notice->id) { while ($notice->fetch()) {
// Skip! if ($notice->id == $this->notice->id) {
continue; // Skip!
} continue;
$cnt++; }
if ($cnt > self::INITIAL_ITEMS) { $cnt++;
// boo-yah if ($cnt > self::INITIAL_ITEMS) {
$moreCutoff = clone($notice); // boo-yah
break; $moreCutoff = clone($notice);
break;
}
$notices[] = clone($notice); // *grumble* inefficient as hell
} }
$notices[] = clone($notice); // *grumble* inefficient as hell
}
if ($notices) { if ($notices) {
$this->out->elementStart('ul', 'notices threaded-notices xoxo'); $this->out->elementStart('ul', 'notices threaded-notices xoxo');
if ($moreCutoff) { if ($moreCutoff) {
$item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out); $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
$item->show(); $item->show();
} }
foreach (array_reverse($notices) as $notice) { foreach (array_reverse($notices) as $notice) {
$item = new ThreadedNoticeListSubItem($notice, $this->out); $item = new ThreadedNoticeListSubItem($notice, $this->out);
$item->show(); $item->show();
}
$this->out->elementEnd('ul');
} }
$this->out->elementEnd('ul');
} }
parent::showEnd(); parent::showEnd();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment