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

This commit is contained in:
Mario Vavti 2017-10-07 15:40:34 +02:00
parent dc2c6d00fe
commit 4c0e8a61ae
2 changed files with 45 additions and 24 deletions

View File

@ -183,6 +183,7 @@ class Ping extends \Zotlabs\Web\Controller {
if($r) {
xchan_query($r);
foreach($r as $rr) {
$rr['llink'] = str_replace('display/', 'pubstream/?f=&mid=', $rr['llink']);
$result[] = \Zotlabs\Lib\Enotify::format($rr);
}
}

View File

@ -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