From e1a41aff058dab1b6df230a9bde1c42e60b08034 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 20 Mar 2014 23:34:09 +0100 Subject: [PATCH] Groups should now be fast (and accurate) --- mod/network.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mod/network.php b/mod/network.php index e10e7b7880..fed6748777 100644 --- a/mod/network.php +++ b/mod/network.php @@ -531,9 +531,10 @@ die("ss"); info( t('Group is empty')); } - $sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` WHERE (`contact-id` IN ($contact_str) OR `allow_gid` like '".protect_sprintf('%<'.intval($group).'>%')."') and deleted = 0 ORDER BY `created` DESC) AS `temp1` ON $sql_table.$sql_parent = `temp1`.`parent` "; + //$sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` WHERE (`contact-id` IN ($contact_str) OR `allow_gid` like '".protect_sprintf('%<'.intval($group).'>%')."') and deleted = 0 ORDER BY `created` DESC) AS `temp1` ON $sql_table.$sql_parent = `temp1`.`parent` "; - $sql_extra3 .= " AND `contact-id` IN ($contact_str.$contact_str_self) "; + $sql_extra3 .= " AND `contact-id` IN ($contact_str$contact_str_self) "; + $sql_extra3 .= " AND EXISTS (SELECT id FROM `item` WHERE (`contact-id` IN ($contact_str) OR `allow_gid` like '".protect_sprintf('%<'.intval($group).'>%')."') and deleted = 0 AND parent = $sql_table.$sql_parent) "; $o = '

' . t('Group: ') . $r[0]['name'] . '

' . $o; } elseif($cid) {