Bug 1387581 - use getSelectedMsgHdrs() instead of currentlyDisplayedMessage to select correct message in multifolder search (idea by alta88). r=alta88
authorJorg K <jorgk@jorgk.com>
Mon, 11 Sep 2017 22:39:48 +0200
changeset 28860 d4555ce8e26ccf0c00f727140134a5d2adb13339
parent 28859 1bb96ca92a5c5ef44a9e69532498777bdf40e181
child 28861 2ee641160857eb7444edfe2a2864f232f24744bd
push idunknown
push userunknown
push dateunknown
reviewersalta88
bugs1387581
Bug 1387581 - use getSelectedMsgHdrs() instead of currentlyDisplayedMessage to select correct message in multifolder search (idea by alta88). r=alta88
mail/base/content/folderDisplay.js
--- a/mail/base/content/folderDisplay.js
+++ b/mail/base/content/folderDisplay.js
@@ -1349,19 +1349,18 @@ FolderDisplayWidget.prototype = {
       aFolder, aSubject, aKeywords) {
     // Hide previous stale message to prevent brief threadpane selection and
     // content displayed mismatch, on both folder and tab changes.
     let browser = getBrowser();
     if (browser && browser.contentDocument && browser.contentDocument.body)
       browser.contentDocument.body.hidden = true;
 
     UpdateMailToolbar("FolderDisplayWidget displayed message changed");
-    let viewIndex = this.view.dbView.currentlyDisplayedMessage;
-    let msgHdr = (viewIndex != nsMsgViewIndex_None) ?
-                   this.view.dbView.getMsgHdrAt(viewIndex) : null;
+    let selected = this.view.dbView.getSelectedMsgHdrs();
+    let msgHdr = selected.length ? selected[0] : null;
     this.messageDisplay.onDisplayingMessage(msgHdr);
 
     // Although deletes should now be so fast that the user has no time to do
     //  anything, treat the user explicitly choosing to display a different
     //  message as invalidating the choice we automatically made for them when
     //  they initiated the message delete / move. (bug 243532)
     // Note: legacy code used to check whether the message being displayed was
     //  the one being deleted, so it didn't erroneously clear the next message