Skip to content

Commit

Permalink
[mms] Throttle message list keypresses in dynamic view to prevent ava…
Browse files Browse the repository at this point in the history
…lanche of preview requests sent to server (Request #13574).
  • Loading branch information
slusarz committed Oct 2, 2014
1 parent 3336caa commit e8c6afe
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions imp/docs/CHANGES
Expand Up @@ -2,6 +2,8 @@
v6.3.0-git
----------

[mms] Throttle message list keypresses in dynamic view to prevent avalanche of
preview requests sent to server (Request #13574).
[mms] Filter out relative image URLs in HTML message data.
[mms] Implement lazy loading for images in HTML messages.
[mms] Add 'dynamic_prefs' hook to allow for changing of default values for
Expand Down
32 changes: 30 additions & 2 deletions imp/js/dimpbase.js
Expand Up @@ -14,6 +14,7 @@ var DimpBase = {
// flist,
INBOX: 'SU5CT1g', // 'INBOX' base64url encoded
// init,
// is_keydown,
mboxDragConfig: {
classname: 'mboxdrag',
ghosting: true,
Expand Down Expand Up @@ -187,7 +188,7 @@ var DimpBase = {
row_data = row.get('dataob').first();
if (!curr_row || row_data.VP_id != curr_row.VP_id) {
this.viewport.scrollTo(row_data.VP_rownum, { bottom: bottom });
this.viewport.select(row, { delay: 0.5 });
this.viewport.select(row);
}
} else if (curr) {
this.rownum = curr;
Expand Down Expand Up @@ -1731,7 +1732,8 @@ var DimpBase = {
var curr, last, p, peek, pp_uid, rows, tmp,
msgload = {};

if (!DimpCore.getPref('preview')) {
if (this.is_keydown ||
!DimpCore.getPref('preview')) {
return;
}

Expand Down Expand Up @@ -2584,6 +2586,8 @@ var DimpBase = {

sel = this.viewport.getSelected();

this.is_keydown = true;

switch (kc) {
case Event.KEY_DELETE:
case Event.KEY_BACKSPACE:
Expand Down Expand Up @@ -2760,6 +2764,29 @@ var DimpBase = {
}
},

keyupHandler: function(e)
{
if (!this.is_keydown) {
return;

}

this.is_keydown = false;

switch (e.keyCode || e.charCode) {
case Event.KEY_UP:
case Event.KEY_DOWN:
case Event.KEY_LEFT:
case Event.KEY_RIGHT:
case Event.KEY_PAGEUP:
case Event.KEY_PAGEDOWN:
case Event.KEY_HOME:
case Event.KEY_END:
this.initPreviewPane();
break;
}
},

dblclickHandler: function(e)
{
var elt = e.element(),
Expand Down Expand Up @@ -4450,6 +4477,7 @@ document.observe('dom:loaded', function() {

/* Basic event handlers. */
document.observe('keydown', DimpBase.keydownHandler.bindAsEventListener(DimpBase));
document.observe('keyup', DimpBase.keyupHandler.bindAsEventListener(DimpBase));
Event.observe(window, 'resize', DimpBase.onResize.bind(DimpBase));

/* Drag/drop listeners. */
Expand Down
1 change: 1 addition & 0 deletions imp/package.xml
Expand Up @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [mms] Throttle message list keypresses in dynamic view to prevent avalanche of preview requests sent to server (Request #13574).
* [mms] Filter out relative image URLs in HTML message data.
* [mms] Implement lazy loading for images in HTML messages.
* [mms] Add &apos;dynamic_prefs&apos; hook to allow for changing of default values for browser-based preferences in dynamic view.
Expand Down

0 comments on commit e8c6afe

Please sign in to comment.