Bug 916095 - After renaming imap folder, message list is not dislayed only once. r=aceman
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Sat, 12 Nov 2016 10:25:01 +0100
changeset 20689 666da1b1fc5721d00a996c1b52d864f649fa2fd6
parent 20688 228b399d8933abaa10c96f7616f5f98fb452821e
child 20690 71581aa2080102ab14918586874cdf0285ac1ba0
push id12519
push userrichard.marti@gmail.com
push dateSat, 12 Nov 2016 09:25:47 +0000
treeherdercomm-central@09ec66578aae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs916095
Bug 916095 - After renaming imap folder, message list is not dislayed only once. r=aceman
mail/base/modules/dbViewWrapper.js
--- a/mail/base/modules/dbViewWrapper.js
+++ b/mail/base/modules/dbViewWrapper.js
@@ -229,16 +229,19 @@ var FolderNotificationHelper = {
       this._notifyHelper(aFolder, "_compactedFolder");
     }
     else if (eventType == "DeleteOrMoveMsgCompleted") {
       this._notifyHelper(aFolder, "_deleteCompleted");
     }
     else if (eventType == "DeleteOrMoveMsgFailed") {
       this._notifyHelper(aFolder, "_deleteFailed");
     }
+    else if (eventType == "RenameCompleted") {
+      this._notifyHelper(aFolder, "_renameCompleted");
+    }
 
   },
 
   OnItemIntPropertyChanged: function(aFolder, aProperty, aOldValue, aNewValue) {
     let propertyString = aProperty.toString();
     if ((propertyString == "TotalMessages") ||
         (propertyString == "TotalUnreadMessages"))
       this._notifyHelper(aFolder, "_messageCountsChanged");
@@ -1256,16 +1259,26 @@ DBViewWrapper.prototype = {
    * See _deleteCompleted for an explanation of what is going on.
    */
   _deleteFailed: function DBViewWrapper__deleteFailed(aFolder) {
     if (this.dbView)
       this.dbView.onDeleteCompleted(false);
     this.listener.onMessageRemovalFailed();
   },
 
+  _forceOpen: function DBViewWrapper__forceOpen(aFolder) {
+    this.displayedFolder = null;
+    this.open(aFolder);
+  },
+
+  _renameCompleted: function DBViewWrapper__renameCompleted(aFolder) {
+    if (aFolder == this.displayedFolder)
+      this._forceOpen(aFolder);
+  },
+
   /**
    * If the displayed folder had its total message count or total unread message
    *  count change, notify the listener.  (Note: only for the display folder;
    *  not the underlying folders!)
    */
   _messageCountsChanged: function DBViewWrapper__messageCountsChanged(aFolder) {
     if (aFolder == this.displayedFolder)
       this.listener.onMessageCountsChanged();