Need to wait to restore the select handler to avoid nm selecting the next row.

This commit is contained in:
nathangray 2021-03-15 15:58:01 -06:00
parent 976e46fadc
commit 244f306422

View File

@ -3593,14 +3593,10 @@ app.classes.mail = AppJS.extend(
let on_select = nm.options.onselect; let on_select = nm.options.onselect;
_senders[0].parent.setAllSelected(false); _senders[0].parent.setAllSelected(false);
this.mail_preview([],nm); this.mail_preview([],nm);
nm.options.onselect = null;
// thev 4th param indicates if it is a normal move messages action. if not the action is a move2.... (archiveFolder) action // thev 4th param indicates if it is a normal move messages action. if not the action is a move2.... (archiveFolder) action
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages, 'move', (_action.id.substr(0,4)=='move'&&_action.id.substr(4,1)=='2'?'2':'_') ], function(){ egw.json('mail.mail_ui.ajax_copyMessages',[target, messages, 'move', (_action.id.substr(0,4)=='move'&&_action.id.substr(4,1)=='2'?'2':'_') ], function(){
self.unlock_tree(); self.unlock_tree();
// Restore onselect handler
nm.options.onselect = on_select;
// Server response may contain refresh, but it's always delete // Server response may contain refresh, but it's always delete
// Refresh list if current view is the target (happens when pasting) // Refresh list if current view is the target (happens when pasting)
var tree = self.et2.getWidgetById('nm[foldertree]'); var tree = self.et2.getWidgetById('nm[foldertree]');
@ -3609,6 +3605,14 @@ app.classes.mail = AppJS.extend(
// Can't trust the sorting, needs to be full refresh // Can't trust the sorting, needs to be full refresh
nm.refresh(); nm.refresh();
} }
// Need to wait on the restore, since the reply will refresh & reset the selection
nm.options.onselect = function() {
window.setTimeout(function() {
// Restore onselect handler
nm.options.onselect = on_select;
},100)
};
}) })
.sendRequest(); .sendRequest();
this.mail_setRowClass(_senders,'deleted'); this.mail_setRowClass(_senders,'deleted');