mirror of https://github.com/nextcloud/contacts
Select first contact after import if available.
This commit is contained in:
parent
3df3154b2e
commit
2987b07a1b
|
@ -56,6 +56,13 @@ angular.module('contactsApp')
|
|||
ctrl.loading = true;
|
||||
|
||||
ContactService.registerObserverCallback(function(ev) {
|
||||
/* after import at first refresh the contactList */
|
||||
if (ev.event === 'importend') {
|
||||
$scope.$apply(function() {
|
||||
ctrl.contactList = ev.contacts;
|
||||
});
|
||||
}
|
||||
/* update route parameters */
|
||||
$timeout(function() {
|
||||
$scope.$apply(function() {
|
||||
switch(ev.event) {
|
||||
|
@ -69,10 +76,12 @@ angular.module('contactsApp')
|
|||
});
|
||||
break;
|
||||
case 'importend':
|
||||
/* after import select 'All contacts' group and first contact */
|
||||
$route.updateParams({
|
||||
gid: t('contacts', 'All contacts')
|
||||
gid: t('contacts', 'All contacts'),
|
||||
uid: ctrl.filteredContacts.length !== 0 ? ctrl.filteredContacts[0].uid() : undefined
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case 'getFullContacts' || 'update':
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -260,7 +260,7 @@ angular.module('contactsApp')
|
|||
}
|
||||
num++;
|
||||
/* Import is over, let's notify */
|
||||
if(num >= singleVCards.length) {
|
||||
if (num === singleVCards.length + 1) {
|
||||
notifyObservers('importend');
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue