]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
off-by-one error in notice stream
authorEvan Prodromou <evan@prodromou.name>
Sun, 18 May 2008 18:59:40 +0000 (14:59 -0400)
committerEvan Prodromou <evan@prodromou.name>
Sun, 18 May 2008 18:59:40 +0000 (14:59 -0400)
darcs-hash:20080518185940-84dde-fb7a3af877c67b5d7e9c59d32092c1392a0ecd58.gz

actions/all.php
actions/public.php
actions/showstream.php

index 92ae385ca76df611b56aa7a9130e2bc4fb3dbdea..7cd1f5beba9a9146c23eb62f0986c42de0e87447 100644 (file)
@@ -38,7 +38,7 @@ class AllAction extends ShowstreamAction {
                
                $page = $this->arg('page') || 1;
                
-               $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+               $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
                
                $notice->find();
                
@@ -48,6 +48,7 @@ class AllAction extends ShowstreamAction {
                        $this->show_notice($notice);
                }
                
+               # XXX: show a link for the next page
                common_element_end('div');
        }
 }
index 5b1e50fa3f1ce82c5d1a7fd3e61c0eed2a67ead1..7776125792c1f7262e124a809e872a0a937f8277 100644 (file)
@@ -44,7 +44,7 @@ class PublicAction extends StreamAction {
                # XXX: filter out private notifications
 
                $notice->orderBy('created DESC');
-               $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+               $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
 
                $notice->find();
 
index 81f5a3db391deb51ff415d133f3f5ef950fc97cb..861f58c29b0d22548a7c3add6982c78babf5ef08 100644 (file)
@@ -190,15 +190,15 @@ class ShowstreamAction extends StreamAction {
                // XXX: WORM cache this
                $subs = DB_DataObject::factory('subscription');
                $subs->subscriber = $profile->id;
-               $subs_count = $subs->count();
+               $subs_count = $subs->count() || 0;
 
                $subbed = DB_DataObject::factory('subscription');
                $subbed->subscribed = $profile->id;
-               $subbed_count = $subbed->count();
+               $subbed_count = $subbed->count() || 0;
 
                $notices = DB_DataObject::factory('notice');
                $notices->profile_id = $profile->id;
-               $notice_count = $notices->count();
+               $notice_count = $notices->count() || 0;
 
                # Other stats...?
                common_element_start('dl', 'statistics');
@@ -220,7 +220,7 @@ class ShowstreamAction extends StreamAction {
 
                $page = $this->arg('page') || 1;
 
-               $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+               $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
 
                $notice->find();
 
@@ -229,7 +229,7 @@ class ShowstreamAction extends StreamAction {
                while ($notice->fetch()) {
                        $this->show_notice($notice);
                }
-
+               # XXX: show a link for the next page
                common_element_end('div');
        }
 
@@ -237,7 +237,7 @@ class ShowstreamAction extends StreamAction {
                $notice = DB_DataObject::factory('notice');
                $notice->profile_id = $profile->id;
                $notice->orderBy('created DESC');
-               $notice->limit(1, 1);
+               $notice->limit(0, 1);
                $notice->find();
 
                while ($notice->fetch()) {