diff --git a/share/html/Elements/ShowHistoryHeader b/share/html/Elements/ShowHistoryHeader
index ade5f349a32..4d386cc8cf6 100644
--- a/share/html/Elements/ShowHistoryHeader
+++ b/share/html/Elements/ShowHistoryHeader
@@ -132,11 +132,12 @@ if ( $ShowDisplayModes or $ShowTitle or $ScrollShowHistory ) {
<& /Widgets/TitleBoxStart, title => $title, titleright_raw => $titleright, class => 'fullwidth' &>
% }
+% my $url = '';
% if ( $Object->isa('RT::Ticket') ) {
<%perl>
my %params = map { $_ => $ARGS{$_} } grep { !ref $ARGS{$_} } keys %ARGS;
-my $url = RT->Config->Get('WebPath') . "/Helpers/TicketHistoryPage?" .
+$url = RT->Config->Get('WebPath') . "/Helpers/TicketHistoryPage?" .
$m->comp('/Elements/QueryString', %params, id => $Object->id );
my $oldestTransactionsFirst;
@@ -305,4 +306,4 @@ jQuery(function(){
% }
-
+
diff --git a/share/html/Helpers/TicketHistoryPage b/share/html/Helpers/TicketHistoryPage
index 06965669dcc..cc0dd05f392 100644
--- a/share/html/Helpers/TicketHistoryPage
+++ b/share/html/Helpers/TicketHistoryPage
@@ -51,6 +51,7 @@ $oldestTransactionsFirst => RT->Config->Get("OldestTransactionsFirst", $session{
$lastTransactionId => undef
$focusTransactionId => undef
$loadAll => 0
+$mode => 'append'
%ARGS>
<%INIT>
my $TicketObj = RT::Ticket->new($session{'CurrentUser'});
@@ -69,7 +70,7 @@ my $order = $oldestTransactionsFirst ? 'ASC' : 'DESC';
if ($lastTransactionId) {
$transactions->Limit(
FIELD => 'id',
- OPERATOR => $oldestTransactionsFirst ? '>' : '<',
+ OPERATOR => $mode eq 'prepend' || $oldestTransactionsFirst ? '>' : '<',
VALUE => $lastTransactionId
);
}
diff --git a/share/static/js/util.js b/share/static/js/util.js
index f1d083d866e..be3f715dd0f 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -780,6 +780,29 @@ jQuery(function() {
if ( RT.Config.OldestTransactionsFirst ) {
history_container.removeAttribute('data-disable-scroll-loading');
}
+ else {
+ const url = history_container.getAttribute('data-url');
+ if ( url ) {
+ let queryString = '&mode=prepend&loadAll=1';
+ let lastTransaction = history_container.querySelector('.transaction');
+ if ( lastTransaction ) {
+ queryString += '&lastTransactionId=' + lastTransaction.dataset.transactionId;
+ }
+
+ jQuery.ajax({
+ url: url + queryString,
+ success: function(html) {
+ const transactions = jQuery(html).filter('div.transaction');
+ if( html && transactions.length ) {
+ jQuery(".history-container").prepend(html);
+ }
+ },
+ error: function(xhr, reason) {
+ jQuery.jGrowl(reason, { sticky: true, themeState: 'none' });
+ }
+ });
+ }
+ }
}
}
});