load more notifications if visible notifications count becomes < 15

This commit is contained in:
Mario
2020-10-18 09:47:46 +00:00
parent b5b033fe22
commit ff8c9cfd14

View File

@@ -1805,14 +1805,16 @@ function sse_bs_notifications(e, replace, followup) {
var cn_val = (($('#cn-' + sse_type + '-input').length && sse_partial_result) ? $('#cn-' + sse_type + '-input').val().toString().toLowerCase() : '');
$("#nav-" + sse_type + "-loading").show();
$.get('/sse_bs/' + sse_type + '/' + sse_offset + '?nquery=' + encodeURIComponent(cn_val), function(obj) {
console.log('sse: bootstraping ' + sse_type);
console.log(obj);
sse_bs_active = false;
sse_offset = obj[sse_type].offset;
if(sse_offset < 0)
$("#nav-" + sse_type + "-loading").hide();
$("#nav-" + sse_type + "-loading").hide();
sse_handleNotifications(obj, replace, followup);
@@ -1864,6 +1866,15 @@ function sse_handleNotifications(obj, replace, followup) {
});
}
// load more notifications if visible notifications count becomes < 15
if(sse_type) {
if($('#nav-' + sse_type + '-menu').children().length < 15) {
if(!sse_bs_active) {
sse_bs_notifications(sse_type, false, true);
}
}
}
}
function sse_handleNotificationsItems(notifyType, data, replace, followup) {
@@ -1978,4 +1989,5 @@ function sse_setNotificationsStatus() {
$('#no_notifications').show();
$('#notifications').hide();
}
}