From 179478a9401c059e16588654d878e6a7813904cb Mon Sep 17 00:00:00 2001 From: git-marijus Date: Thu, 27 Jul 2017 21:51:59 +0200 Subject: default to static updates if not local channel --- Zotlabs/Module/Pubstream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 28c34425c..7689c10cc 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -27,7 +27,7 @@ class Pubstream extends \Zotlabs\Web\Controller { if(! $update) { - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 0); + $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); $maxheight = get_config('system','home_divmore_height'); if(! $maxheight) -- cgit v1.2.3 From f9b342c87d4129c457244861b3b841cb9dfe139b Mon Sep 17 00:00:00 2001 From: git-marijus Date: Fri, 28 Jul 2017 22:42:02 +0200 Subject: initial notifications support for new shared files and new (since initial site load) pubstream activity --- Zotlabs/Module/Pubstream.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 7689c10cc..fd19ca98e 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -7,10 +7,11 @@ require_once('include/conversation.php'); class Pubstream extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { + if($load) $_SESSION['loadtime'] = datetime_convert(); - + if(observer_prohibited(true)) { return login(); @@ -27,6 +28,8 @@ class Pubstream extends \Zotlabs\Web\Controller { if(! $update) { + $_SESSION['static_loadtime'] = datetime_convert(); + $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); $maxheight = get_config('system','home_divmore_height'); -- cgit v1.2.3 From 5a1b850dd6510cd6ece5c1e49589510aa1782cf6 Mon Sep 17 00:00:00 2001 From: git-marijus Date: Sat, 29 Jul 2017 12:24:03 +0200 Subject: provide public stream notification also for not authenticated viewers --- Zotlabs/Module/Pubstream.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index fd19ca98e..d9054dc48 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -8,7 +8,6 @@ class Pubstream extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { - if($load) $_SESSION['loadtime'] = datetime_convert(); -- cgit v1.2.3 From 68b32cd8f414fc3df1279a3458082b2d8dfc3430 Mon Sep 17 00:00:00 2001 From: git-marijus Date: Sun, 6 Aug 2017 21:40:39 +0200 Subject: consolidate disable_discover_tab config if it was not yet set to either 1 or 0 in DB --- Zotlabs/Module/Pubstream.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index d9054dc48..5db485d21 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -16,8 +16,8 @@ class Pubstream extends \Zotlabs\Web\Controller { return login(); } - - if(get_config('system','disable_discover_tab')) + $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; + if($disable_discover_tab) return; $item_normal = item_normal(); -- cgit v1.2.3 From dc18440c18549a07b31c7506316e7a4bd40b9712 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 3 Sep 2017 21:33:07 +0200 Subject: introduce item_normal_update(). the differnce to item_normal() is that we do not query for item_deleted = 0 and therefor can find deleted likes which allows us to update our unlikes on the fly if static page update is enabled --- Zotlabs/Module/Pubstream.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 5db485d21..ef818845c 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -21,6 +21,7 @@ class Pubstream extends \Zotlabs\Web\Controller { return; $item_normal = item_normal(); + $item_normal_update = item_normal_update(); $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); @@ -134,7 +135,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE true $uids $item_normal + WHERE true $uids $item_normal_update AND item.parent = item.id $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets" -- cgit v1.2.3 From a7d339be5a80bd9b6d3c9441f37f4ad33d8afa84 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 21 Sep 2017 23:11:15 +0200 Subject: nav_set_selected() and minor whitespace for mod pubstream --- Zotlabs/Module/Pubstream.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index ef818845c..72d5f80fa 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -28,6 +28,8 @@ class Pubstream extends \Zotlabs\Web\Controller { if(! $update) { + nav_set_selected(t('Public Stream')); + $_SESSION['static_loadtime'] = datetime_convert(); $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); @@ -108,7 +110,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $simple_update = ''; if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; //logger('update: ' . $update . ' load: ' . $load); -- cgit v1.2.3 From 4c0e8a61aecc5c90d532016dc42f13ab07646335 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 7 Oct 2017 15:40:34 +0200 Subject: provide single post view for pubstream and rewrite llink to point to /pubstream/?f=&mid=some_mid instead of /display/some_mid for pubs notifications --- Zotlabs/Module/Pubstream.php | 68 ++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 24 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 72d5f80fa..4583f912b 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -19,7 +19,9 @@ class Pubstream extends \Zotlabs\Web\Controller { $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; if($disable_discover_tab) return; - + + $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); + $item_normal = item_normal(); $item_normal_update = item_normal_update(); @@ -30,7 +32,8 @@ class Pubstream extends \Zotlabs\Web\Controller { nav_set_selected(t('Public Stream')); - $_SESSION['static_loadtime'] = datetime_convert(); + if(!$mid) + $_SESSION['static_loadtime'] = datetime_convert(); $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); @@ -68,7 +71,7 @@ class Pubstream extends \Zotlabs\Web\Controller { '$cats' => '', '$tags' => '', '$dend' => '', - '$mid' => '', + '$mid' => $mid, '$verb' => '', '$dbegin' => '' )); @@ -119,29 +122,46 @@ class Pubstream extends \Zotlabs\Web\Controller { $ordering = "commented"; if($load) { - - // Fetch a page full of parent items for this page - - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on item.author_xchan = abook.abook_xchan - WHERE true $uids $item_normal - AND item.parent = item.id - and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets - ORDER BY $ordering DESC $pager_sql " - ); - - + if($mid) { + $r = q("SELECT parent AS item_id FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE mid like '%s' $uids $item_normal + and (abook.abook_blocked = 0 or abook.abook_flags is null) + $sql_extra3 $sql_extra $sql_nets", + dbesc($mid . '%') + ); + } + else { + // Fetch a page full of parent items for this page + $r = q("SELECT distinct item.id AS item_id, $ordering FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE true $uids $item_normal + AND item.parent = item.id + and (abook.abook_blocked = 0 or abook.abook_flags is null) + $sql_extra3 $sql_extra $sql_nets + ORDER BY $ordering DESC $pager_sql " + ); + } } elseif($update) { - - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on item.author_xchan = abook.abook_xchan - WHERE true $uids $item_normal_update - AND item.parent = item.id $simple_update - and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets" - ); + if($mid) { + $r = q("SELECT parent AS item_id FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE mid like '%s' $uids $item_normal_update $simple_update + and (abook.abook_blocked = 0 or abook.abook_flags is null) + $sql_extra3 $sql_extra $sql_nets", + dbesc($mid . '%') + ); + } + else { + $r = q("SELECT distinct item.id AS item_id, $ordering FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE true $uids $item_normal_update + AND item.parent = item.id $simple_update + and (abook.abook_blocked = 0 or abook.abook_flags is null) + $sql_extra3 $sql_extra $sql_nets" + ); + } $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page -- cgit v1.2.3 From 71c206fdb9d8ccdd0b65feb49db93a58ea51e0e6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 7 Oct 2017 16:40:43 +0200 Subject: pubstream single view fixes --- Zotlabs/Module/Pubstream.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Pubstream.php') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 4583f912b..15e2d8a74 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -22,13 +22,18 @@ class Pubstream extends \Zotlabs\Web\Controller { $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); + if(strpos($mid,'b64.') === 0) + $decoded = @base64url_decode(substr($mid,4)); + if($decoded) + $mid = $decoded; + $item_normal = item_normal(); $item_normal_update = item_normal_update(); $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - if(! $update) { + if(! $update && !$load) { nav_set_selected(t('Public Stream')); @@ -46,6 +51,10 @@ class Pubstream extends \Zotlabs\Web\Controller { . "; var profile_page = " . \App::$pager['page'] . "; divmore_height = " . intval($maxheight) . "; \r\n"; + //if we got a decoded hash we must encode it again before handing to javascript + if($decoded) + $mid = 'b64.' . base64url_encode($mid); + \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'pubstream', @@ -127,7 +136,7 @@ class Pubstream extends \Zotlabs\Web\Controller { left join abook on item.author_xchan = abook.abook_xchan WHERE mid like '%s' $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets", + $sql_extra3 $sql_extra $sql_nets LIMIT 1", dbesc($mid . '%') ); } @@ -149,7 +158,7 @@ class Pubstream extends \Zotlabs\Web\Controller { left join abook on item.author_xchan = abook.abook_xchan WHERE mid like '%s' $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets", + $sql_extra3 $sql_extra $sql_nets LIMIT 1", dbesc($mid . '%') ); } @@ -193,6 +202,9 @@ class Pubstream extends \Zotlabs\Web\Controller { $mode = ('network'); $o .= conversation($items,$mode,$update,$page_mode); + + if($mid) + $o .= '
'; if(($items) && (! $update)) $o .= alt_pager($a,count($items)); -- cgit v1.2.3