mod_network: privacy group query returning results when group is empty. Notification that the group is empty was also displayed twice.

This commit is contained in:
zotlabs 2018-04-25 22:53:20 -07:00
parent 4409b2b40a
commit fe724acc3b

View File

@ -218,15 +218,13 @@ class Network extends \Zotlabs\Web\Controller {
$contact_str = ''; $contact_str = '';
$contacts = group_get_members($group); $contacts = group_get_members($group);
if($contacts) { if($contacts) {
foreach($contacts as $c) { $contact_str = ids_to_querystr($contacts,'xchan',true);
if($contact_str)
$contact_str .= ',';
$contact_str .= "'" . $c['xchan'] . "'";
}
} }
else { else {
$contact_str = ' 0 '; $contact_str = " '0' ";
info( t('Privacy group is empty')); if(! $update) {
info( t('Privacy group is empty'));
}
} }
$item_thread_top = ''; $item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) "; $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
@ -480,7 +478,6 @@ class Network extends \Zotlabs\Web\Controller {
$ordering = "commented"; $ordering = "commented";
if($load) { if($load) {
// Fetch a page full of parent items for this page // Fetch a page full of parent items for this page
$r = q("SELECT item.parent AS item_id FROM item $r = q("SELECT item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )