]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
fixup tag display code
authorEvan Prodromou <evan@controlyourself.ca>
Sun, 28 Sep 2008 18:15:03 +0000 (14:15 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Sun, 28 Sep 2008 18:15:03 +0000 (14:15 -0400)
darcs-hash:20080928181503-5ed1f-4a4046000646530b8462f06d0cfc0d2fe862dc48.gz

actions/tag.php

index 8b5548e45809435115ee3ad26f9faa54087e79ab..177aee603a785d3f13c154aaa61e51c99b30ccce 100644 (file)
@@ -159,23 +159,17 @@ class TagAction extends StreamAction {
 
        function show_notices($tag) {
 
-               $notices = Notice_tag::getStream($tag, (($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
-               
-               if ($cnt > 0) {
+               $cnt = 0;
+               $notice = Notice_tag::getStream($tag, (($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
+
+               if ($notice) {
                        common_element_start('ul', array('id' => 'notices'));
-                       for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
-                               if ($tags->fetch()) {
-                                       $notice = new Notice();
-                                       $notice->id = $tags->notice_id;
-                                       $result = $notice->find(true);
-                                       if (!$result) {
-                                               continue;
-                                       }
-                                       $this->show_notice($notice);
-                               } else {
-                                       // shouldn't happen!
+                       while ($notice->fetch()) {
+                               $cnt++;
+                               if ($cnt > NOTICES_PER_PAGE) {
                                        break;
                                }
+                               $this->show_notice($notice);
                        }
                        common_element_end('ul');
                }