From f317da3bd78a7b9d39accc90a5752b5bfff02250 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 12 Oct 2009 17:28:23 -0600 Subject: [PATCH] Correctly remove special container folders when empty --- imp/js/DimpBase.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index cfa230915..fc3295568 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -1268,7 +1268,7 @@ var DimpBase = { if (f.endsWith('_special')) { f = f.slice(0, -8); } - return 'sub' + f; + return 'sub_' + f; }, /* Folder list updates. */ @@ -2228,9 +2228,21 @@ var DimpBase = { changeFolder: function(ob) { - var fid = this.getFolderId(ob.m), - fdiv = $(fid).down('DIV'), - oldexpand = fdiv && fdiv.hasClassName('col'); + var fdiv, oldexpand, + fid = this.getFolderId(ob.m); + + if ($(fid + '_special')) { + // The case of children being added to a special folder is + // handled by createFolder(). + if (!ob.ch) { + this.deleteFolderElt(fid + '_special', true); + } + return; + } + + fdiv = $(fid).down('DIV'); + oldexpand = fdiv && fdiv.hasClassName('col'); + this.deleteFolderElt(fid, !ob.ch); if (ob.co && this.folder == ob.m) { this.go('folder:INBOX'); -- 2.11.0