Use throttle to link to support tickets

This commit is contained in:
yflory 2020-02-11 18:05:59 +01:00
parent a9e4af1d12
commit bba769ef77

View File

@ -206,7 +206,11 @@ define([
}); });
}; };
var to; var to = Util.throttle(function () {
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+linkedId+'"]');
$ticket[0].scrollIntoView();
linkedId = undefined;
}, 100);
// Register to the "support" mailbox // Register to the "support" mailbox
common.mailbox.subscribe(['supportadmin'], { common.mailbox.subscribe(['supportadmin'], {
@ -255,14 +259,7 @@ define([
$ticket.append(APP.support.makeMessage(content, hash)); $ticket.append(APP.support.makeMessage(content, hash));
reorder(); reorder();
if (linkedId) { if (linkedId) { to(); }
clearTimeout(to);
to = setTimeout(function () {
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+linkedId+'"]');
$ticket[0].scrollIntoView();
linkedId = undefined;
}, 100);
}
} }
}); });
return $container; return $container;