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 38e9d9984f
commit e56055f12d

View File

@ -228,11 +228,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]])
{
// 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);
}
}
});
}