From 1fc36c4470461e1d4f72480773b064c7202e921d Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 20 Oct 2020 20:43:51 +0000 Subject: [PATCH 1/3] Only auto update when there is content --- include/conversation.php | 1 + view/js/main.js | 6 ++++++ view/templates/conversation.tpl | 5 ++--- view/templates/threaded_conversation.tpl | 5 ++--- view/theme/frio/templates/threaded_conversation.tpl | 7 +++---- view/theme/quattro/templates/conversation.tpl | 5 ++--- view/theme/quattro/templates/threaded_conversation.tpl | 5 ++--- view/theme/vier/templates/threaded_conversation.tpl | 5 ++--- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index baf7633a7..6adc00d0c 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -697,6 +697,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o '$live_update' => $live_update_div, '$remove' => DI::l10n()->t('remove'), '$mode' => $mode, + '$update' => $update, '$user' => $a->user, '$threads' => $threads, '$dropping' => ($page_dropping ? DI::l10n()->t('Delete Selected Items') : False), diff --git a/view/js/main.js b/view/js/main.js index b523ce6e7..89c4e91f6 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -620,6 +620,12 @@ function liveUpdate(src) { in_progress = false; update_item = 0; + if (data.length < 100) { + // console.log('No data ' + data.length + ':' + data); + return; + } + // console.log('Got data: ' + data.length + ':' + data); + $('.wall-item-body', data).imagesLoaded(function() { updateConvItems(data); diff --git a/view/templates/conversation.tpl b/view/templates/conversation.tpl index 5a4ca2d63..761a31a84 100644 --- a/view/templates/conversation.tpl +++ b/view/templates/conversation.tpl @@ -1,6 +1,4 @@ - {{$live_update nofilter}} - {{foreach $threads as $thread}}
{{foreach $thread.items as $item}} @@ -18,7 +16,7 @@ {{/foreach}}
{{/foreach}} - +{{if !$update}}
{{if $dropping}} @@ -28,3 +26,4 @@
{{/if}} +{{/if}} diff --git a/view/templates/threaded_conversation.tpl b/view/templates/threaded_conversation.tpl index d993c6b33..f4a47354e 100644 --- a/view/templates/threaded_conversation.tpl +++ b/view/templates/threaded_conversation.tpl @@ -1,10 +1,8 @@ - {{$live_update nofilter}} - {{foreach $threads as $thread}} {{include file="{{$thread.template}}" item=$thread}} {{/foreach}} - +{{if !$update}}
{{if $dropping}} @@ -15,3 +13,4 @@
{{/if}} +{{/if}} diff --git a/view/theme/frio/templates/threaded_conversation.tpl b/view/theme/frio/templates/threaded_conversation.tpl index f618da281..de5522fa9 100644 --- a/view/theme/frio/templates/threaded_conversation.tpl +++ b/view/theme/frio/templates/threaded_conversation.tpl @@ -1,8 +1,6 @@ - +{{if !$update}}{{/if}} {{if $mode == display}}{{/if}} - {{$live_update nofilter}} - {{foreach $threads as $thread}}
@@ -15,7 +13,7 @@
{{/foreach}} - +{{if !$update}}
{{if $dropping}} @@ -24,3 +22,4 @@ {{/if}} +{{/if}} diff --git a/view/theme/quattro/templates/conversation.tpl b/view/theme/quattro/templates/conversation.tpl index ce89d579e..7e7f8cea8 100644 --- a/view/theme/quattro/templates/conversation.tpl +++ b/view/theme/quattro/templates/conversation.tpl @@ -1,5 +1,4 @@ {{$live_update nofilter}} - {{foreach $threads as $thread}}
{{foreach $thread.items as $item}} @@ -23,7 +22,7 @@ {{/foreach}}
{{/foreach}} - +{{if !$update}}
{{if $dropping}} @@ -46,4 +45,4 @@ $('#item-'+id).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000); {{/if}} - +{{/if}} diff --git a/view/theme/quattro/templates/threaded_conversation.tpl b/view/theme/quattro/templates/threaded_conversation.tpl index 33431361f..640ecbfd0 100644 --- a/view/theme/quattro/templates/threaded_conversation.tpl +++ b/view/theme/quattro/templates/threaded_conversation.tpl @@ -1,5 +1,4 @@ {{$live_update nofilter}} - {{foreach $threads as $thread}}
@@ -13,7 +12,7 @@
{{/foreach}} - +{{if !$update}}
{{if $dropping}} @@ -37,4 +36,4 @@ $('#item-'+id).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000); {{/if}} - +{{/if}} diff --git a/view/theme/vier/templates/threaded_conversation.tpl b/view/theme/vier/templates/threaded_conversation.tpl index 35807f991..de35497d2 100644 --- a/view/theme/vier/templates/threaded_conversation.tpl +++ b/view/theme/vier/templates/threaded_conversation.tpl @@ -1,5 +1,4 @@ {{$live_update nofilter}} - {{foreach $threads as $thread}}
@@ -13,7 +12,7 @@
{{/foreach}} - +{{if !$update}}
{{if $dropping}} @@ -37,4 +36,4 @@ $('#item-'+id).animate(colWhite, 1000).animate(colShiny).animate(colWhite, 2000); {{/if}} - +{{/if}} From d6662d65dda434cdbb6072fddbbda985cbc5bba4 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 21 Oct 2020 12:13:57 +0000 Subject: [PATCH 2/3] Log messages removed --- view/js/main.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/view/js/main.js b/view/js/main.js index 89c4e91f6..164716d21 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -621,10 +621,8 @@ function liveUpdate(src) { update_item = 0; if (data.length < 100) { - // console.log('No data ' + data.length + ':' + data); return; } - // console.log('Got data: ' + data.length + ':' + data); $('.wall-item-body', data).imagesLoaded(function() { updateConvItems(data); From 9870c8584fb69afac93c8958d00c9d607257ad24 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 23 Oct 2020 20:29:29 +0000 Subject: [PATCH 3/3] Improved check for existing data --- view/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/js/main.js b/view/js/main.js index 164716d21..2e665d100 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -620,7 +620,7 @@ function liveUpdate(src) { in_progress = false; update_item = 0; - if (data.length < 100) { + if ($('.wall-item-body', data).length == 0) { return; }