From 64ed01f0aff569da2fd4ed589df9ed4ee9852cb7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 22 Jul 2008 12:02:13 -0400 Subject: centralize and optimize with-friends query darcs-hash:20080722160213-84dde-2e466b9cc4601a8cb7237770a7df17a2f9dcadb9.gz --- actions/allrss.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'actions/allrss.php') diff --git a/actions/allrss.php b/actions/allrss.php index 26e3f5241..a64b47641 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -42,17 +42,13 @@ class AllrssAction extends Rss10Action { function get_notices($limit=0) { $user = $this->user; - $notices = array(); - - $notice = DB_DataObject::factory('notice'); - - $notice->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$user->id.' and subscribed = notice.profile_id)', 'OR'); - $notice->whereAdd('profile_id = ' . $user->id, 'OR'); - - $notice->orderBy('created DESC, notice.id DESC'); + + $notice = $user->noticesWithFriends(); + if ($limit != 0) { $notice->limit(0, $limit); } + $notice->find(); while ($notice->fetch()) { -- cgit v1.2.3-54-g00ecf