(js) Fix issues with the mail advanced search

- fixed loading of headers when scrolling the virtual repeater;
- fixed viewing a single message;
- fixed search from a mailbox that contains subfolders.
This commit is contained in:
Francis Lachapelle
2015-09-14 14:58:00 -04:00
parent e30fb0d1fb
commit 47ab4b837c
4 changed files with 57 additions and 26 deletions
@@ -68,7 +68,15 @@
}
function startAdvancedSearch() {
var root, mailboxes = [];
var root, mailboxes = [],
_visit = function(folders) {
_.each(folders, function(o) {
mailboxes.push(o);
if (o.children && o.children.length > 0) {
_visit(o.children);
}
});
};
vm.virtualMailbox = new VirtualMailbox(vm.accounts[0]);
@@ -84,9 +92,8 @@
if (angular.isDefined(vm.search.mailbox)) {
root = vm.accounts[0].$getMailboxByPath(vm.search.mailbox);
mailboxes.push(root);
if (vm.search.subfolders && root.children.length)
mailboxes.push(root.children);
_visit(root.children);
}
else {
mailboxes = vm.accounts[0].$flattenMailboxes();