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