defer calls to mail_refreshFolderStatus for 2s, to accumulate updates of multiple rows e.g. deleting multiple emails

This commit is contained in:
ralf 2023-01-25 14:55:06 +01:00
parent bf49c486ae
commit 07d6488593

View File

@ -214,10 +214,19 @@ app.classes.mail = AppJS.extend(
if(nm != null && (typeof jQuery._data(nm).events=='undefined'||typeof jQuery._data(nm).events.refresh == 'undefined'))
{
var self = this;
jQuery(nm).on('refresh',function(_event, _widget, _row_id, _type) {
jQuery(nm).on('refresh', (_event, _widget, _row_id, _type) =>
{
if (!self.push_active[_widget.settings.foldertree.split("::")[0]])
{
self.mail_refreshFolderStatus.call(self,undefined,undefined,false);
// defer calls to mail_refreshFolderStatus for 2s, to accumulate updates of multiple rows e.g. deleting multiple emails
if (typeof self.refresh_timeout === 'undefined')
{
self.refresh_timeout = window.setTimeout(() =>
{
delete self.refresh_timeout;
self.mail_refreshFolderStatus.call(self, undefined, undefined, false);
}, 2000);
}
}
});
}
@ -6506,4 +6515,4 @@ app.classes.mail = AppJS.extend(
resizable: false,
}, et2_dialog._create_parent('mail'));
}
});
});