From 4002531b9296f764c20da2f50ff1bb5feef6dccb Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 29 Nov 2022 10:00:07 +0000 Subject: fix issue where site_firehose setting was always false --- Zotlabs/Module/Pubstream.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 3c8dfa0a5..47da3c13a 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,6 +12,7 @@ class Pubstream extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { + if(local_channel()) { if(! Apps::system_app_installed(local_channel(), 'Public Stream')) { //Do not display any associated widgets at this point @@ -31,16 +32,13 @@ class Pubstream extends \Zotlabs\Web\Controller { } } - $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); - if(! ($site_firehose || $net_firehose)) { + if(!$net_firehose) { return ''; } - if($net_firehose) { - $site_firehose = false; - } + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : ''); if ($mid === false) { @@ -161,13 +159,14 @@ class Pubstream extends \Zotlabs\Web\Controller { $sys = get_sys_channel(); $abook_uids = " and abook.abook_channel = " . intval($sys['channel_id']) . " "; + $sql_extra = ''; if($site_firehose) { $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 "; } else { $uids = " and item.uid = " . intval($sys['channel_id']) . " "; - $sql_extra = item_permissions_sql($sys['channel_id']); + $sql_extra .= item_permissions_sql($sys['channel_id']); \App::$data['firehose'] = intval($sys['channel_id']); } -- cgit v1.2.3 From 07417080865852fc82c866c5ea975ca5df3101a0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 1 Jan 2023 21:21:13 +0100 Subject: change the logic of building the site only public stream. we will now fetch sys channel items but restrict them to authors of this site only. this fixes a comment permission issue. --- Zotlabs/Module/Pubstream.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 47da3c13a..d9156e4bf 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -158,16 +158,13 @@ class Pubstream extends \Zotlabs\Web\Controller { require_once('include/security.php'); $sys = get_sys_channel(); + $uids = " and item.uid = " . intval($sys['channel_id']) . " "; $abook_uids = " and abook.abook_channel = " . intval($sys['channel_id']) . " "; - $sql_extra = ''; + $sql_extra = item_permissions_sql($sys['channel_id']); + $site_firehose_sql = ''; if($site_firehose) { - $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 "; - } - else { - $uids = " and item.uid = " . intval($sys['channel_id']) . " "; - $sql_extra .= item_permissions_sql($sys['channel_id']); - \App::$data['firehose'] = intval($sys['channel_id']); + $site_firehose_sql = " and author_xchan in (select channel_hash from channel where channel_system = 0 and channel_removed = 0) "; } if(get_config('system','public_list_mode')) @@ -199,7 +196,9 @@ class Pubstream extends \Zotlabs\Web\Controller { $r = q("SELECT parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan $net_query - WHERE mid = '%s' $uids $item_normal + WHERE item.mid = '%s' and item.item_private = 0 + $uids $site_firehose_sql + $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra $net_query2", dbesc($mid) @@ -207,10 +206,12 @@ class Pubstream extends \Zotlabs\Web\Controller { } else { // Fetch a page full of parent items for this page - $r = dbq("SELECT item.id AS item_id FROM item + $r = dbq("SELECT parent AS item_id FROM item left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) $net_query - WHERE true $uids and item.item_thread_top = 1 $item_normal + WHERE item.item_private = 0 and item.item_thread_top = 1 + $uids $site_firehose_sql + $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra $net_query2 ORDER BY $ordering DESC $pager_sql " @@ -222,7 +223,8 @@ class Pubstream extends \Zotlabs\Web\Controller { $r = q("SELECT parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan $net_query - WHERE mid = '%s' $uids $item_normal_update $simple_update + WHERE item.mid = '%s' and item.item_private = 0 + $uids $site_firehose_sql $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra $net_query2", dbesc($mid) @@ -232,7 +234,8 @@ class Pubstream extends \Zotlabs\Web\Controller { $r = dbq("SELECT parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan $net_query - WHERE true $uids $item_normal_update + WHERE item.item_private = 0 and item.item_thread_top = 1 + $uids $site_firehose_sql $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra $net_query2" @@ -256,7 +259,7 @@ class Pubstream extends \Zotlabs\Web\Controller { // use effective_uid param of xchan_query to help sort out comment permission // for sys_channel owned items. - xchan_query($items,true,(($sys) ? local_channel() : 0)); + xchan_query($items, true, local_channel()); $items = fetch_post_tags($items,true); $items = conv_sort($items,$ordering); } -- cgit v1.2.3 From de0d2afc154196ed80960435ac9c74ce37635576 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 2 Jan 2023 21:56:20 +0000 Subject: fix issues with pubstream tagcloud --- Zotlabs/Module/Pubstream.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index d9156e4bf..7b8d75727 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -161,10 +161,12 @@ class Pubstream extends \Zotlabs\Web\Controller { $uids = " and item.uid = " . intval($sys['channel_id']) . " "; $abook_uids = " and abook.abook_channel = " . intval($sys['channel_id']) . " "; $sql_extra = item_permissions_sql($sys['channel_id']); + $sql_extra_order = ''; $site_firehose_sql = ''; + $thread_top = " and item.item_thread_top = 1 "; if($site_firehose) { - $site_firehose_sql = " and author_xchan in (select channel_hash from channel where channel_system = 0 and channel_removed = 0) "; + $site_firehose_sql = " and owner_xchan in (select channel_hash from channel where channel_system = 0 and channel_removed = 0) "; } if(get_config('system','public_list_mode')) @@ -175,6 +177,8 @@ class Pubstream extends \Zotlabs\Web\Controller { if(x($hashtags)) { $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG)); + $sql_extra_order = " ORDER BY item.created DESC "; + $thread_top = ''; } $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); @@ -209,7 +213,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $r = dbq("SELECT parent AS item_id FROM item left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) $net_query - WHERE item.item_private = 0 and item.item_thread_top = 1 + WHERE item.item_private = 0 $thread_top $uids $site_firehose_sql $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) @@ -234,7 +238,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $r = dbq("SELECT parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan $net_query - WHERE item.item_private = 0 and item.item_thread_top = 1 + WHERE item.item_private = 0 $thread_top $uids $site_firehose_sql $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) @@ -253,15 +257,22 @@ class Pubstream extends \Zotlabs\Web\Controller { $items = dbq("SELECT item.*, item.id AS item_id FROM item WHERE true $uids $item_normal AND item.parent IN ( $parents_str ) - $sql_extra" + $sql_extra $sql_extra_order" ); + + // use effective_uid param of xchan_query to help sort out comment permission // for sys_channel owned items. xchan_query($items, true, local_channel()); $items = fetch_post_tags($items,true); - $items = conv_sort($items,$ordering); + + if (!$hashtags) { + $items = conv_sort($items, $ordering); + } + + } } -- cgit v1.2.3 From 23828f53bcd762f778b97c57a6d29ab59e83082d Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 5 Jan 2023 10:29:42 +0100 Subject: pubstream: when going to conv from unthreaded mode stay in the module --- Zotlabs/Module/Pubstream.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 7b8d75727..9d3a4f92b 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -40,7 +40,8 @@ class Pubstream extends \Zotlabs\Web\Controller { $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); - $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : ''); + $mid = (($_REQUEST['mid']) ? unpack_link_id($_REQUEST['mid']) : ''); + if ($mid === false) { notice(t('Malformed message id.') . EOL); return; @@ -261,7 +262,6 @@ class Pubstream extends \Zotlabs\Web\Controller { ); - // use effective_uid param of xchan_query to help sort out comment permission // for sys_channel owned items. @@ -277,8 +277,7 @@ class Pubstream extends \Zotlabs\Web\Controller { } - // fake it - $mode = (($hashtags) ? 'search' : 'pubstream'); + $mode = (($hashtags) ? 'pubstream-new' : 'pubstream'); $o .= conversation($items,$mode,$update,$page_mode); -- cgit v1.2.3