X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fpublic.php;h=f99215dadbdd8aec3759aa37ac53d7d67e9d9b28;hb=803bdff3f67cce50931ce75dd209883a93a20bd3;hp=7452859616db936b3b44032bc35584c82f69a666;hpb=87b494f1ebbe7640d194ef322af12fdf378295df;p=quix0rs-gnu-social.git diff --git a/actions/public.php b/actions/public.php index 7452859616..f99215dadb 100644 --- a/actions/public.php +++ b/actions/public.php @@ -59,13 +59,15 @@ class PublicAction extends StreamAction { function show_notices($page) { - $notice = DB_DataObject::factory('notice'); + $notice = new Notice(); - # FIXME: bad performance + # XXX: sub-optimal - $notice->whereAdd('EXISTS (SELECT user.id from user where user.id = notice.profile_id)'); + if (common_config('public', 'localonly')) { + $notice->is_local = 1; + } - $notice->orderBy('created DESC'); + $notice->orderBy('created DESC, notice.id DESC'); # We fetch one extra, to see if we need an "older" link @@ -75,7 +77,8 @@ class PublicAction extends StreamAction { if ($cnt > 0) { common_element_start('ul', array('id' => 'notices')); - for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) { + $iMax = min($cnt, NOTICES_PER_PAGE); + for ($i = 0; $i < $iMax; $i++) { if ($notice->fetch()) { $this->show_notice($notice); } else {