[Rt-commit] rt branch, 4.4/scroll-txn-whole-list, created. rt-4.4.2-99-gbd54d85b8
? sunnavy
sunnavy at bestpractical.com
Wed Mar 21 10:02:25 EDT 2018
The branch, 4.4/scroll-txn-whole-list has been created
at bd54d85b847c71436580137054137e9759750eb6 (commit)
- Log -----------------------------------------------------------------
commit bd54d85b847c71436580137054137e9759750eb6
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..992d3da45 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 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 2dff85c97..c6f49ea4b 100644
--- a/share/html/Ticket/Elements/ScrollShowHistory
+++ b/share/html/Ticket/Elements/ScrollShowHistory
@@ -146,6 +146,12 @@ jQuery(function(){
if(html && transactions.length) {
lastTransactionId = transactions.last().data('transactionId');
jQuery(".history-container").append(html);
+ if ( transactions.filter(':not(.hidden)').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