Fix bug where next row wasn't selected after deleting a collapsed thread (#6655)

pull/6841/head
Aleksander Machniak 6 years ago
parent 1dbf187a45
commit 27b9448d6c

@ -9,6 +9,7 @@ CHANGELOG Roundcube Webmail
- Fix so mime_content_type check in Installer uses files that should always be available (i.e. from program/resources) (#6599) - Fix so mime_content_type check in Installer uses files that should always be available (i.e. from program/resources) (#6599)
- Fix missing CSRF token on a link to download too-big message part (#6621) - Fix missing CSRF token on a link to download too-big message part (#6621)
- Fix bug when aborting dragging with ESC key didn't stop the move action (#6623) - Fix bug when aborting dragging with ESC key didn't stop the move action (#6623)
- Fix bug where next row wasn't selected after deleting a collapsed thread (#6655)
RELEASE 1.3.8 RELEASE 1.3.8
------------- -------------

@ -355,8 +355,11 @@ remove_row: function(uid, sel_next)
node.style.display = 'none'; node.style.display = 'none';
// Specify removed row uid in the select_next argument.
// It's needed because after removing a set of rows
// reference to the last selected message is lost.
if (sel_next) if (sel_next)
this.select_next(); this.select_next(uid);
delete this.rows[uid]; delete this.rows[uid];
this.rowcount--; this.rowcount--;
@ -877,12 +880,12 @@ get_row_uid: function(row)
/** /**
* get first/next/previous/last rows that are not hidden * get first/next/previous/last rows that are not hidden
*/ */
get_next_row: function() get_next_row: function(uid)
{ {
if (!this.rowcount) if (!this.rowcount)
return false; return false;
var last_selected_row = this.rows[this.last_selected], var last_selected_row = this.rows[uid || this.last_selected],
new_row = last_selected_row ? last_selected_row.obj.nextSibling : null; new_row = last_selected_row ? last_selected_row.obj.nextSibling : null;
while (new_row && (new_row.nodeType != 1 || new_row.style.display == 'none')) while (new_row && (new_row.nodeType != 1 || new_row.style.display == 'none'))
@ -891,12 +894,12 @@ get_next_row: function()
return new_row; return new_row;
}, },
get_prev_row: function() get_prev_row: function(uid)
{ {
if (!this.rowcount) if (!this.rowcount)
return false; return false;
var last_selected_row = this.rows[this.last_selected], var last_selected_row = this.rows[uid || this.last_selected],
new_row = last_selected_row ? last_selected_row.obj.previousSibling : null; new_row = last_selected_row ? last_selected_row.obj.previousSibling : null;
while (new_row && (new_row.nodeType != 1 || new_row.style.display == 'none')) while (new_row && (new_row.nodeType != 1 || new_row.style.display == 'none'))
@ -1031,15 +1034,12 @@ select: function(id)
/** /**
* Select row next to the last selected one. * Select row next to the specified or last selected one
* Either below or above. * Either below or above.
*/ */
select_next: function() select_next: function(uid)
{ {
var next_row = this.get_next_row(), var new_row = this.get_next_row(uid) || this.get_prev_row(uid);
prev_row = this.get_prev_row(),
new_row = (next_row) ? next_row : prev_row;
if (new_row) if (new_row)
this.select_row(new_row.uid, false, false); this.select_row(new_row.uid, false, false);
}, },

Loading…
Cancel
Save