diff --git a/modoboa/extensions/webmail/imaputils.py b/modoboa/extensions/webmail/imaputils.py index 46cdd73f2..67065363a 100644 --- a/modoboa/extensions/webmail/imaputils.py +++ b/modoboa/extensions/webmail/imaputils.py @@ -415,6 +415,9 @@ class IMAPconnector(object): @capability('LIST-EXTENDED', '_listmboxes_simple') def _listmboxes(self, topmailbox, mailboxes, until_mailbox=None): + """Retrieve mailboxes list. + + """ pattern = "%s%s%%" % (topmailbox.encode("imap4-utf-7"), self.hdelimiter) \ if len(topmailbox) else "%" resp = self._cmd("LIST", "", pattern, "RETURN", "(CHILDREN)") @@ -443,6 +446,8 @@ class IMAPconnector(object): if r'\Marked' in flags or not r'\UnMarked' in flags: descr["send_status"] = True if r'\HasChildren' in flags: + if r'\NonExistent' in flags: + descr["removed"] = True descr["path"] = name descr["sub"] = [] if until_mailbox and until_mailbox.startswith(name): @@ -489,7 +494,8 @@ class IMAPconnector(object): continue del mb["send_status"] key = "path" if "path" in mb else "name" - count = self.unseen_messages(mb[key]) + if not mb.get("removed", False): + count = self.unseen_messages(mb[key]) if count == 0: continue mb["unseen"] = count diff --git a/modoboa/extensions/webmail/static/webmail/js/webmail.js b/modoboa/extensions/webmail/static/webmail/js/webmail.js index 110b8c6ef..14ea120c7 100644 --- a/modoboa/extensions/webmail/static/webmail/js/webmail.js +++ b/modoboa/extensions/webmail/static/webmail/js/webmail.js @@ -693,8 +693,14 @@ Webmail.prototype = { }, listmailbox_loader: function(event) { + var $target = get_target(event, "a"); + + if ($target.parent().hasClass("disabled")) { + event.preventDefault(); + return; + } this.select_mailbox(event.target); - this._listmailbox_loader(event, get_target(event, "a")); + this._listmailbox_loader(event, $target); }, /* diff --git a/modoboa/extensions/webmail/templatetags/webmail_tags.py b/modoboa/extensions/webmail/templatetags/webmail_tags.py index 3ac199460..49a907af6 100644 --- a/modoboa/extensions/webmail/templatetags/webmail_tags.py +++ b/modoboa/extensions/webmail/templatetags/webmail_tags.py @@ -132,7 +132,9 @@ def print_mailboxes(tree, selected=None, withunseen=False, selectonly=False, hde cssclass = "" name = mbox["path"] if "sub" in mbox else mbox["name"] label = separate_mailbox(mbox["name"], hdelimiter)[0] - if selected == name: + if mbox.get("removed", False): + cssclass = "disabled" + elif selected == name: cssclass = "active" result += "
  • \n" % (name, cssclass) if "sub" in mbox: