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

pull/6662/head
Aleksander Machniak 6 years ago
parent ad4ea7e62e
commit 5058d36581

@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
=========================== ===========================
- Elastic: Add hide/show for advanced preferences (#6632) - Elastic: Add hide/show for advanced preferences (#6632)
- Fix bug where next row wasn't selected after deleting a collapsed thread (#6655)
RELEASE 1.4-rc1 RELEASE 1.4-rc1
--------------- ---------------

@ -360,8 +360,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--;
@ -940,12 +943,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'))
@ -954,12 +957,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'))
@ -1110,12 +1113,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 new_row = this.get_next_row() || this.get_prev_row(); var new_row = this.get_next_row(uid) || this.get_prev_row(uid);
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