[Rt-commit] rt branch, 4.4/scroll-txn-whole-list, created. rt-4.4.2-153-gc25cc4c20
? sunnavy
sunnavy at bestpractical.com
Tue Apr 17 03:32:48 EDT 2018
The branch, 4.4/scroll-txn-whole-list has been created
at c25cc4c20828ab0129dd8f9bbf7f4b3070ec9787 (commit)
- Log -----------------------------------------------------------------
commit c25cc4c20828ab0129dd8f9bbf7f4b3070ec9787
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Mar 21 21:17:14 2018 +0800
In case all the txns on the page are skipped for scroll type of ShowHistory
When it happens, we need to inform AJAX request that it's not the real
end, and client could try loading more transactions automatically.
diff --git a/share/html/Elements/ShowHistoryPage b/share/html/Elements/ShowHistoryPage
index 52767085a..68291d1b6 100644
--- a/share/html/Elements/ShowHistoryPage
+++ b/share/html/Elements/ShowHistoryPage
@@ -151,5 +151,14 @@ while ( my $Transaction = $Transactions->Next ) {
$i++;
}
+
+# For scroll, it's possible that all the transactions in this page were
+# skipped for some reasons and there are still pages left, so we need to
+# inform AJAX request that it's not done yet.
+
+if ( $i == 1 and RT->Config->Get( "ShowHistory", $session{'CurrentUser'} ) eq 'scroll' and my $txn = $Transactions->Last ) {
+ $m->out( q{<div class="hidden end-of-history-list transaction" data-transaction-id="} . $txn->id . qq{"></div>\n} );
+}
+
</%perl>
diff --git a/share/html/Ticket/Elements/ScrollShowHistory b/share/html/Ticket/Elements/ScrollShowHistory
index 18fdeb548..781c116ce 100644
--- a/share/html/Ticket/Elements/ScrollShowHistory
+++ b/share/html/Ticket/Elements/ScrollShowHistory
@@ -142,6 +142,12 @@ jQuery(function(){
if(html && transactions.length) {
lastTransactionId = transactions.last().data('transactionId');
jQuery(".history-container").append(html);
+ if ( transactions.filter(':not(.hidden.end-of-history-list)').length == 0 ) {
+ // if none is visible, automatically load more
+ isLoading = false;
+ loadHistoryPage();
+ return;
+ }
if (hashTransactionId) { // focus transaction if we are following a link to it
hashTransactionId = null;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list