From f2fd12fbe544d5e87680aed98489698b4ca9ddd6 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 18 Nov 2020 09:52:44 +0000 Subject: Do away with auto updates except for our own actions. We might consider to re-implement this for single thread view like eg /display. Instead of calculating scroll positions during updates, keep track of expanded items and set the expanded state when updating - this fixes issue #1488 --- Zotlabs/Module/Channel.php | 25 ++------- Zotlabs/Module/Display.php | 25 ++------- Zotlabs/Module/Filer.php | 3 +- Zotlabs/Module/Filerm.php | 10 +++- Zotlabs/Module/Hq.php | 22 ++------ Zotlabs/Module/Network.php | 25 ++------- Zotlabs/Module/Pubstream.php | 42 ++++---------- Zotlabs/Module/Search.php | 9 --- Zotlabs/Module/Settings/Display.php | 3 - boot.php | 2 +- include/channel.php | 20 ------- include/text.php | 2 +- view/js/main.js | 109 ++++++------------------------------ view/tpl/build_query.tpl | 2 - view/tpl/item_filer.tpl | 2 +- view/tpl/jot-header.tpl | 13 +++-- view/tpl/settings_display.tpl | 1 - 17 files changed, 68 insertions(+), 247 deletions(-) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index dc8e9e1c5..f61c8bdc9 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -130,9 +130,6 @@ class Channel extends Controller { $noscript_content = get_config('system', 'noscript_content', '1'); - if($load) - $_SESSION['loadtime'] = datetime_convert(); - $category = $datequery = $datequery2 = ''; $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); @@ -152,7 +149,6 @@ class Channel extends Controller { $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'post'); - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); $search = ((x($_GET,'search')) ? $_GET['search'] : EMPTY_STR); $groups = array(); @@ -187,8 +183,6 @@ class Channel extends Controller { nav_set_selected('Channel Home'); - $static = channel_manual_conv_update(App::$profile['profile_uid']); - // search terms header if($search) { $o .= replace_macros(get_markup_template("section_title.tpl"),array( @@ -255,7 +249,9 @@ class Channel extends Controller { $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " "; - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); + $simple_update = ''; + if($update && $_SESSION['loadtime']) + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; if($search) { $search = escape_tags($search); @@ -270,7 +266,6 @@ class Channel extends Controller { } } - head_add_link([ 'rel' => 'alternate', 'type' => 'application/json+oembed', @@ -278,14 +273,6 @@ class Channel extends Controller { 'title' => 'oembed' ]); - if($update && $_SESSION['loadtime']) - $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; - if($load) - $simple_update = ''; - - if($static && $simple_update) - $simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - if(($update) && (! $load)) { if($mid) { @@ -294,7 +281,6 @@ class Channel extends Controller { dbesc($mid . '%'), intval(App::$profile['profile_uid']) ); - $_SESSION['loadtime'] = datetime_convert(); } else { $r = q("SELECT parent AS item_id from item @@ -306,9 +292,7 @@ class Channel extends Controller { ORDER BY created DESC", intval(App::$profile['profile_uid']) ); - $_SESSION['loadtime'] = datetime_convert(); } - } else { @@ -424,7 +408,6 @@ class Channel extends Controller { '$wall' => '1', '$fh' => '0', '$dm' => '0', - '$static' => $static, '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => $search, '$xchan' => '', @@ -476,6 +459,8 @@ class Channel extends Controller { if($mid) $o .= '
'; + $_SESSION['loadtime'] = datetime_convert(); + return $o; } } diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 3d61d7018..5d3ea94ff 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -22,9 +22,6 @@ class Display extends \Zotlabs\Web\Controller { $module_format = 'html'; } - if($load) - $_SESSION['loadtime'] = datetime_convert(); - if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; @@ -183,22 +180,11 @@ class Display extends \Zotlabs\Web\Controller { return ''; } - - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - + $simple_update = ''; if($update && $_SESSION['loadtime']) - $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; - if($load) - $simple_update = ''; - - if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - - if((! $update) && (! $load)) { + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); + if((! $update) && (! $load)) { // if the target item is not a post (eg a like) we want to address its thread parent @@ -229,7 +215,6 @@ class Display extends \Zotlabs\Web\Controller { '$dm' => '0', '$nouveau' => '0', '$wall' => '0', - '$static' => $static, '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', @@ -315,7 +300,6 @@ class Display extends \Zotlabs\Web\Controller { dbesc($target_item['parent_mid']) ); } - if($r === null) { // in case somebody turned off public access to sys channel content using permissions // make that content unsearchable by ensuring the owner_xchan can't match @@ -335,7 +319,6 @@ class Display extends \Zotlabs\Web\Controller { intval($sysid) ); } - $_SESSION['loadtime'] = datetime_convert(); } else { @@ -448,6 +431,8 @@ class Display extends \Zotlabs\Web\Controller { } + $_SESSION['loadtime'] = datetime_convert(); + return $o; } diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index af59f28fb..c2747e6c2 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -31,7 +31,8 @@ class Filer extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) { - $x = q("update item set item_retained = 1 where id = %d and uid = %d", + $x = q("update item set item_retained = 1, changed = '%s' where id = %d and uid = %d", + dbesc(datetime_convert()), intval($r[0]['parent']), intval(local_channel()) ); diff --git a/Zotlabs/Module/Filerm.php b/Zotlabs/Module/Filerm.php index cbf6a118d..9fdfe6c46 100644 --- a/Zotlabs/Module/Filerm.php +++ b/Zotlabs/Module/Filerm.php @@ -28,10 +28,14 @@ class Filerm extends \Zotlabs\Web\Controller { intval($item_id), dbesc($term) ); + + $x = q("update item set item_retained = 0, changed = '%s' where id = %d and uid = %d", + dbesc(datetime_convert()), + intval($item_id), + intval(local_channel()) + ); + } - - if(x($_SESSION,'return_url')) - goaway(z_root() . '/' . $_SESSION['return_url']); killme(); } diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index e2678c07f..3f5c4ed52 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -38,9 +38,6 @@ class Hq extends \Zotlabs\Web\Controller { if(!local_channel()) return; - if($load) - $_SESSION['loadtime'] = datetime_convert(); - if(argc() > 1 && argv(1) !== 'load') { $item_hash = argv(1); } @@ -87,15 +84,9 @@ class Hq extends \Zotlabs\Web\Controller { goaway(z_root() . '/moderate/' . $target_item['id']); } - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - + $simple_update = ''; if($update && $_SESSION['loadtime']) - $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; - - if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; $sys = get_sys_channel(); $sql_extra = item_permissions_sql($sys['channel_id']); @@ -148,8 +139,6 @@ class Hq extends \Zotlabs\Web\Controller { nav_set_selected('HQ'); - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); - if($target_item) { // if the target item is not a post (eg a like) we want to address its thread parent //$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']); @@ -182,8 +171,7 @@ class Hq extends \Zotlabs\Web\Controller { '$dm' => '0', '$nouveau' => '0', '$wall' => '0', - '$static' => $static, - '$page' => 1, + '$page' => '1', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', '$xchan' => '', @@ -249,8 +237,6 @@ class Hq extends \Zotlabs\Web\Controller { intval($sys['channel_id']) ); } - - $_SESSION['loadtime'] = datetime_convert(); } else { $r = []; @@ -275,6 +261,8 @@ class Hq extends \Zotlabs\Web\Controller { $o .= '
'; + $_SESSION['loadtime'] = datetime_convert(); + return $o; } diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index bbacbb21e..ff62bdda2 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -44,10 +44,6 @@ class Network extends \Zotlabs\Web\Controller { $o = ''; - if($load) { - $_SESSION['loadtime'] = datetime_convert(); - } - $arr = array('query' => App::$query_string); call_hooks('network_content_init', $arr); @@ -64,7 +60,6 @@ class Network extends \Zotlabs\Web\Controller { $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); - $static = ((x($_GET,'static')) ? intval($_GET['static']) : 0); $gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); @@ -213,8 +208,6 @@ class Network extends \Zotlabs\Web\Controller { $status_editor = status_editor($a,$x,false,'Network'); $o .= $status_editor; - $static = channel_manual_conv_update(local_channel()); - } @@ -370,7 +363,6 @@ class Network extends \Zotlabs\Web\Controller { '$dm' => (($dm) ? $dm : '0'), '$nouveau' => (($nouveau) ? $nouveau : '0'), '$wall' => '0', - '$static' => $static, '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => (($search) ? urlencode($search) : ''), @@ -494,8 +486,6 @@ class Network extends \Zotlabs\Web\Controller { $parents_str = ''; - $simple_update = (($update) ? " and item_unseen = 1 " : ''); - // This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day // or three and look at your matrix page - after opening up your browser. The first page loads just as it // should. All of a sudden a few seconds later, page 2 will get inserted at the beginning of the page @@ -507,16 +497,11 @@ class Network extends \Zotlabs\Web\Controller { // which "arrived as you were reading page 1". We're going to do this // by storing in your session the current UTC time whenever you LOAD a network page, and only UPDATE items // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers... - - if($update && $_SESSION['loadtime']) - $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; - if($load) - $simple_update = ''; + $simple_update = ''; + if($update && $_SESSION['loadtime']) + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; - if($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, created FROM item @@ -524,7 +509,6 @@ class Network extends \Zotlabs\Web\Controller { $net_query WHERE true $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $simple_update $sql_extra $sql_options $sql_nets $net_query2 ORDER BY item.created DESC $pager_sql " @@ -570,7 +554,6 @@ class Network extends \Zotlabs\Web\Controller { and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_options $sql_nets $net_query2" ); - $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page @@ -605,6 +588,8 @@ class Network extends \Zotlabs\Web\Controller { if(($items) && (! $update)) $o .= alt_pager(count($items)); + + $_SESSION['loadtime'] = datetime_convert(); return $o; } diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 55c96b23d..e6afdb391 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -23,9 +23,6 @@ class Pubstream extends \Zotlabs\Web\Controller { } } - if($load) - $_SESSION['loadtime'] = datetime_convert(); - if((observer_prohibited(true))) { return login(); } @@ -59,7 +56,6 @@ class Pubstream extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); $net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : ''); $title = replace_macros(get_markup_template("section_title.tpl"),array( @@ -103,21 +99,11 @@ class Pubstream extends \Zotlabs\Web\Controller { $o .= status_editor($a,$x,false,'Pubstream'); $o .= ''; } - - - - - if(! $update && !$load) { nav_set_selected(t('Public Stream')); - if(!$mid) - $_SESSION['static_loadtime'] = datetime_convert(); - - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); - $maxheight = get_config('system','home_divmore_height'); if(! $maxheight) $maxheight = 400; @@ -148,7 +134,6 @@ class Pubstream extends \Zotlabs\Web\Controller { '$nouveau' => '0', '$wall' => '0', '$list' => '0', - '$static' => $static, '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => '', '$xchan' => '', @@ -200,14 +185,10 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " "; - - $simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : ''); - - if($load) - $simple_update = ''; - if($static && $simple_update) - $simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update = ''; + if($update && $_SESSION['loadtime']) + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) AND author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; //logger('update: ' . $update . ' load: ' . $load); @@ -220,10 +201,10 @@ 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 like '%s' $uids $item_normal + WHERE mid = '%s' $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1", - dbesc($mid . '%') + $sql_extra3 $sql_extra $sql_nets $net_query2", + dbesc($mid) ); } else { @@ -243,10 +224,10 @@ 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 like '%s' $uids $item_normal_update $simple_update + WHERE mid = '%s' $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1", - dbesc($mid . '%') + $sql_extra3 $sql_extra $sql_nets $net_query2", + dbesc($mid) ); } else { @@ -259,7 +240,6 @@ class Pubstream extends \Zotlabs\Web\Controller { $sql_extra3 $sql_extra $sql_nets $net_query2" ); } - $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page @@ -291,7 +271,7 @@ class Pubstream extends \Zotlabs\Web\Controller { // fake it $mode = (($hashtags) ? 'search' : 'pubstream'); - + $o .= conversation($items,$mode,$update,$page_mode); if($mid) @@ -300,6 +280,8 @@ class Pubstream extends \Zotlabs\Web\Controller { if(($items) && (! $update)) $o .= alt_pager(count($items)); + $_SESSION['loadtime'] = datetime_convert(); + return $o; } diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index d586ae12f..c22bf2836 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -19,9 +19,6 @@ class Search extends \Zotlabs\Web\Controller { } } - if($load) - $_SESSION['loadtime'] = datetime_convert(); - nav_set_selected('Search'); require_once("include/bbcode.php"); @@ -54,8 +51,6 @@ class Search extends \Zotlabs\Web\Controller { $search = ((x($_GET,'tag')) ? trim(escape_tags(rawurldecode($_GET['tag']))) : ''); } - $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); - $o .= search($search,'search-box','/search',((local_channel()) ? true : false)); if(strpos($search,'#') === 0) { @@ -105,9 +100,6 @@ class Search extends \Zotlabs\Web\Controller { if((! $update) && (! $load)) { - $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 0); - - // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. @@ -131,7 +123,6 @@ class Search extends \Zotlabs\Web\Controller { '$dm' => '0', '$nouveau' => '0', '$wall' => '0', - '$static' => $static, '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), '$search' => (($tag) ? urlencode('#') : '') . $search, diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 01ae8652a..cade0a529 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -28,7 +28,6 @@ class Display { $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); $title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0); - $manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0); $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0); $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); @@ -47,7 +46,6 @@ class Display { set_pconfig(local_channel(),'system','itemspage', $itemspage); set_pconfig(local_channel(),'system','no_smilies',1-intval($nosmile)); set_pconfig(local_channel(),'system','title_tosource',$title_tosource); - set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); set_pconfig(local_channel(),'system','channel_menu', $channel_menu); set_pconfig(local_channel(),'system','start_menu', $start_menu); @@ -200,7 +198,6 @@ class Display { '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 30 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1-intval($nosmile), '', $yes_no), '$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ], - '$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$theme_config' => $theme_config, '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no] diff --git a/boot.php b/boot.php index 9e32bc783..4e7227f84 100755 --- a/boot.php +++ b/boot.php @@ -50,7 +50,7 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '5.1.5' ); +define ( 'STD_VERSION', '5.1.6' ); define ( 'ZOT_REVISION', '6.0' ); define ( 'DB_UPDATE_VERSION', 1239 ); diff --git a/include/channel.php b/include/channel.php index e2be4d8a8..71fad5222 100644 --- a/include/channel.php +++ b/include/channel.php @@ -2573,26 +2573,6 @@ function channel_reddress($channel) { return strtolower($channel['channel_address'] . '@' . App::get_hostname()); } - -/** - * @brief Get manual channel conversation update config. - * - * Check the channel config \e manual_conversation_update, if not set fall back - * to global system config, defaults to 1 if nothing set. - * - * @param int $channel_id - * @return int - */ -function channel_manual_conv_update($channel_id) { - - $x = get_pconfig($channel_id, 'system', 'manual_conversation_update'); - if($x === false) - $x = get_config('system', 'manual_conversation_update', 1); - - return intval($x); -} - - /** * @brief Return parsed HTML remote_login template. * diff --git a/include/text.php b/include/text.php index 58cde7838..c2a45814c 100644 --- a/include/text.php +++ b/include/text.php @@ -1667,7 +1667,7 @@ function format_filer(&$item) { if(! trim($term)) continue; $removelink = z_root() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']); - $categories[] = array('term' => $term, 'removelink' => $removelink); + $categories[] = array('term' => $term, 'removelink' => $removelink, 'id' => $item['id']); } $s = replace_macros(get_markup_template('item_filer.tpl'),array( diff --git a/view/js/main.js b/view/js/main.js index 3dae45cff..f807fb366 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -20,11 +20,11 @@ var pageHasMoreContent = true; var divmore_height = 400; var last_filestorage_id = null; var mediaPlaying = false; -var contentHeightDiff = 0; var liveRecurse = 0; var savedTitle = ''; var followUpPageLoad = false; var window_needs_alert = true; +var expanded_items = []; var sse_bs_active = false; var sse_offset = 0; @@ -207,33 +207,6 @@ $(document).ready(function() { updateInit(); - // Allow folks to stop the ajax page updates with the pause/break key - $(document).keydown(function(event) { - if(event.keyCode == '8') { - var target = event.target || event.srcElement; - if (!/input|textarea/i.test(target.nodeName)) { - return false; - } - } - - if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) { - event.preventDefault(); - if(stopped === false) { - stopped = true; - if (event.ctrlKey) { - totStopped = true; - } - $('#pause').html('pause'); - } else { - unpause(); - } - } else { - if (!totStopped) { - unpause(); - } - } - }); - var e = document.getElementById('content-complete'); if(e) pageHasMoreContent = false; @@ -646,7 +619,8 @@ function updatePageItems(mode, data) { function updateConvItems(mode,data) { - $(document).trigger('hz:updateConvItems'); + if(mode !== 'update') + $(document).trigger('hz:updateConvItems'); if(mode === 'update' || mode === 'replace') { prev = 'threads-begin'; @@ -871,25 +845,16 @@ function scrollToItem() { } function collapseHeight() { - var origContentHeight = Math.ceil($("#region_2").height()); - var cDiff = 0; - var i = 0; - var position = $(window).scrollTop(); $(".wall-item-content, .directory-collapse").each(function() { var orgHeight = $(this).outerHeight(true); + var id = $(this).attr('id') + var open = ((expanded_items.indexOf($(this).attr('id')) === -1) ? false : true); if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore') && $(this).has('div.no-collapse').length == 0) { - - // check if we will collapse some content above the visible content and compensate the diff later - if($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i) < 65) { - diff = orgHeight - divmore_height; - cDiff = cDiff + diff; - i++; - } - $(this).readmore({ speed: 0, + startOpen: open, heightMargin: 50, collapsedHeight: divmore_height, moreLink: '' + aStr.divgrowmore + '', @@ -899,6 +864,10 @@ function collapseHeight() { if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) { $(window).scrollTop($(window).scrollTop() - ($(element).outerHeight(true) - divmore_height)); } + expanded_items = expanded_items.filter(expanded_items => expanded_items !== id); + } + else { + expanded_items.push(id); } } }); @@ -907,15 +876,6 @@ function collapseHeight() { } }); - var collapsedContentHeight = Math.ceil($("#region_2").height()); - contentHeightDiff = liking ? 0 : origContentHeight - collapsedContentHeight; - console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px'); - - if(i && !liking){ - var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i); - console.log('collapsed above viewport count: ' + i); - $(window).scrollTop(sval); - } } function updateInit() { @@ -950,12 +910,7 @@ function liveUpdate(notify_id) { if((src === null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; } - // if auto updates are enabled and a comment box is open, - // prevent live updates until the comment is submitted - - var lockUpdates = (($('.comment-edit-text.expanded').length && (! bParam_static)) ? true : false); - - if(lockUpdates || in_progress || mediaPlaying) { + if(in_progress || mediaPlaying) { if(livetime) { clearTimeout(livetime); } @@ -1057,11 +1012,6 @@ function liveUpdate(notify_id) { scroll_next = false; updateConvItems(update_mode,data); - // adjust scroll position if new content was added above viewport - if(update_mode === 'update' && !justifiedGalleryActive) { - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); - } - in_progress = false; $('#image_counter').html(''); @@ -1202,7 +1152,6 @@ function justifyPhotosAjax(id) { // trickery. This still could cause confusion if the "like" ajax call // is delayed and updateInit runs before it completes. function dolike(ident, verb) { - unpause(); $('#like-rotator-' + ident.toString()).show(); $.get('like/' + ident.toString() + '?verb=' + verb, updateInit ); liking = 1; @@ -1309,14 +1258,12 @@ function dropItem(url, object) { } function dosubthread(ident) { - unpause(); $('#like-rotator-' + ident.toString()).show(); $.get('subthread/sub/' + ident.toString(), updateInit ); liking = 1; } function dounsubthread(ident) { - unpause(); $('#like-rotator-' + ident.toString()).show(); $.get('subthread/unsub/' + ident.toString(), updateInit ); liking = 1; @@ -1395,18 +1342,18 @@ function submitPoll(id) { function(data) { $.jGrowl(data.message, { sticky: false, theme: ((data.success) ? 'info' : 'notice'), life: 10000 }); if(timer) clearTimeout(timer); - timer = setTimeout(updateInit,1500); + timer = setTimeout(updateInit, 500); } ); } - function post_comment(id) { - unpause(); + commentBusy = true; $('body').css('cursor', 'wait'); $("#comment-preview-inp-" + id).val("0"); + $.post( "item", $("#comment-edit-form-" + id).serialize(), @@ -1430,7 +1377,9 @@ function post_comment(id) { }, "json" ); + return false; + } @@ -1502,13 +1451,6 @@ function preview_mail() { return true; } -function unpause() { - // unpause auto reloads if they are currently stopped - totStopped = false; - stopped = false; - $('#pause').html(''); -} - function bin2hex(s) { // Converts the binary representation of data to hex // @@ -1605,7 +1547,6 @@ function zFormError(elm,x) { } } - $(window).scroll(function () { if(typeof buildCmd == 'function') { // This is a content page with items and/or conversations @@ -1631,22 +1572,6 @@ $(window).scroll(function () { } }); -var chanviewFullSize = false; - -function chanviewFull() { - if(chanviewFullSize) { - chanviewFullSize = false; - $('#chanview-iframe-border').css({ 'position' : 'relative', 'z-index' : '10' }); - $('#remote-channel').css({ 'position' : 'relative' , 'z-index' : '10' }); - } - else { - chanviewFullSize = true; - $('#chanview-iframe-border').css({ 'position' : 'fixed', 'top' : '0', 'left' : '0', 'z-index' : '150001' }); - $('#remote-channel').css({ 'position' : 'fixed', 'top' : '0', 'left' : '0', 'z-index' : '150000' }); - resize_iframe(); - } -} - function addhtmltext(data) { data = h2b(data); addeditortext(data); @@ -1877,8 +1802,6 @@ function sse_bs_notifications(e, replace, followup) { } } - - function sse_handleNotifications(obj, replace, followup) { var primary_notifications = ['dm', 'home', 'intros', 'register', 'mail', 'notify', 'files']; diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl index bbe0ac7ee..69c5e301f 100755 --- a/view/tpl/build_query.tpl +++ b/view/tpl/build_query.tpl @@ -18,7 +18,6 @@ var bParam_list = {{$list}}; var bParam_fh = {{$fh}}; var bParam_dm = {{$dm}}; - var bParam_static = {{$static}}; var bParam_search = "{{$search}}"; var bParam_xchan = "{{$xchan}}"; @@ -42,7 +41,6 @@ if(bParam_cmax != (-1)) bCmd = bCmd + "&cmax=" + bParam_cmax; if(bParam_gid != 0) { bCmd = bCmd + "&gid=" + bParam_gid; } else if(bParam_cid != 0) { bCmd = bCmd + "&cid=" + bParam_cid; } - if(bParam_static != 0) { bCmd = bCmd + "&static=" + bParam_static; } if(bParam_star != 0) bCmd = bCmd + "&star=" + bParam_star; if(bParam_liked != 0) bCmd = bCmd + "&liked=" + bParam_liked; if(bParam_conv!= 0) bCmd = bCmd + "&conv=" + bParam_conv; diff --git a/view/tpl/item_filer.tpl b/view/tpl/item_filer.tpl index 4eb621f93..f814b374c 100644 --- a/view/tpl/item_filer.tpl +++ b/view/tpl/item_filer.tpl @@ -1,7 +1,7 @@ {{if $categories}} {{foreach $categories as $cat}} - {{$cat.term}}  + {{$cat.term}}  {{/foreach}} {{/if}} diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index d78907b38..2539c1fdf 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -303,13 +303,9 @@ var activeCommentText = ''; if(reply && reply.length) { reply = reply.replace('#',''); if(reply.length) { - commentBusy = true; $('body').css('cursor', 'wait'); - - $.get('{{$baseurl}}/tagger/' + id + '?term=' + reply); - if(timer) clearTimeout(timer); - timer = setTimeout(updateInit,3000); + $.get('{{$baseurl}}/tagger/' + id + '?term=' + reply, updateInit); liking = 1; } } @@ -358,6 +354,13 @@ var activeCommentText = ''; } + function itemFilerRm(id, term) { + commentBusy = true; + $('body').css('cursor', 'wait'); + $.get('{{$baseurl}}/filerm/' + id + '?f=&term=' + term, updateInit); + liking = 1; + } + function itemBookmark(id) { $.get('{{$baseurl}}/bookmarks?f=&item=' + id); if(timer) clearTimeout(timer); diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index c93efb4aa..c2dd94175 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -63,7 +63,6 @@ {{include file="field_checkbox.tpl" field=$title_tosource}} {{include file="field_checkbox.tpl" field=$user_scalable}} {{include file="field_checkbox.tpl" field=$preload_images}} - {{include file="field_checkbox.tpl" field=$manual_update}} {{include file="field_checkbox.tpl" field=$start_menu}}
-- cgit v1.2.3