Fix show messages on initial login/folder-sync

This commit is contained in:
Tankred Hase 2014-03-29 01:14:52 +01:00
parent 6ca1ae6507
commit f0f0aa3d63
2 changed files with 15 additions and 19 deletions

View File

@ -66,9 +66,21 @@ define(function(require) {
// init folders
initFolders();
// select inbox as the current folder on init
$scope.openFolder($scope.account.folders[0]);
if ($scope.account.folders && $scope.account.folders.length > 0) {
$scope.openFolder($scope.account.folders[0]);
}
// connect imap/smtp clients on first startup
appController.onConnect($scope.onError);
appController.onConnect(function(err) {
if (err) {
$scope.onError(err);
return;
}
// select inbox if not yet selected
if (!$scope.state.nav.currentFolder) {
$scope.openFolder($scope.account.folders[0]);
}
});
//
// helper functions

View File

@ -73,23 +73,7 @@ define(function(require) {
return;
}
// if empty (first time login) use dummy folders ... overwritten in onConnect
self._account.folders = (folders) ? folders : [{
type: 'Inbox',
path: 'INBOX'
}, {
type: 'Sent',
path: 'SENT'
}, {
type: 'Outbox',
path: 'OUTBOX'
}, {
type: 'Drafts',
path: 'DRAFTS'
}, {
type: 'Trash',
path: 'TRASH'
}];
self._account.folders = folders;
callback(null, keypair);
});