diff options
author | Mario <mario@mariovavti.com> | 2023-01-05 10:29:42 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-01-05 10:29:42 +0100 |
commit | 23828f53bcd762f778b97c57a6d29ab59e83082d (patch) | |
tree | 7c801a5f10ef17b1e9a12be83d67171ea6566f2e | |
parent | f909e129ab6a937b329f86947dd6fb1bf7bda662 (diff) | |
download | volse-hubzilla-23828f53bcd762f778b97c57a6d29ab59e83082d.tar.gz volse-hubzilla-23828f53bcd762f778b97c57a6d29ab59e83082d.tar.bz2 volse-hubzilla-23828f53bcd762f778b97c57a6d29ab59e83082d.zip |
pubstream: when going to conv from unthreaded mode stay in the module
-rw-r--r-- | Zotlabs/Module/Pubstream.php | 7 | ||||
-rw-r--r-- | include/conversation.php | 25 |
2 files changed, 22 insertions, 10 deletions
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); diff --git a/include/conversation.php b/include/conversation.php index 46621a243..caad5bb0e 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -675,7 +675,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa if($items) { - if(in_array($mode, [ 'network-new', 'search', 'community', 'moderate' ])) { + if(is_unthreaded($mode)) { // "New Item View" on network page or search page results // - just loop through the items and format them minimally for display @@ -772,14 +772,17 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) $is_new = true; - $conv_link_mid = (($mode == 'moderate') ? $item['parent_mid'] : $item['mid']); + $conv_link_mid = (($mode == 'moderate') ? gen_link_id($item['parent_mid']) : gen_link_id($item['mid'])); + + $conv_link = z_root() . '/display/' . $conv_link_mid; - $conv_link_module = 'display'; if(local_channel()) { - $conv_link_module = 'hq'; + $conv_link = z_root() . '/hq/' . $conv_link_mid; } - $conv_link = z_root() . '/' . $conv_link_module . '/' . gen_link_id($conv_link_mid); + if ($mode === 'pubstream-new') { + $conv_link = z_root() . '/pubstream?mid=' . $conv_link_mid; + } $contact = []; @@ -996,7 +999,7 @@ function thread_action_menu($item,$mode = '') { 'href' => '#' ]; - if(! in_array($mode, [ 'network-new', 'search', 'community'])) { + if(!is_unthreaded($mode)) { if($item['parent'] == $item['id'] && (get_observer_hash() != $item['author_xchan'])) { $menu[] = [ 'menu' => 'follow_thread', @@ -1784,3 +1787,13 @@ function get_response_button_text($v,$count) { break; } } + +function is_unthreaded($mode) { + return in_array($mode, [ + 'network-new', + 'pubstream-new', + 'search', + 'community', + 'moderate' + ]); +} |