mirror of https://github.com/nextcloud/contacts
Do not switch contact until import is over
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
37286ac317
commit
5aed74a5c8
|
@ -19,6 +19,7 @@ angular.module('contactsApp')
|
|||
ctrl.status = parseInt(Math.floor(progress * 100)) + '%';
|
||||
ctrl.loadingClass = 'icon-loading-small';
|
||||
}
|
||||
scope.$apply();
|
||||
});
|
||||
});
|
||||
}, false);
|
||||
|
|
|
@ -81,6 +81,11 @@ angular.module('contactsApp')
|
|||
uid: ev.uid
|
||||
});
|
||||
}
|
||||
else if (ev.event === 'import') {
|
||||
$route.updateParams({
|
||||
gid: t('contacts', 'All contacts')
|
||||
});
|
||||
}
|
||||
ctrl.contacts = ev.contacts;
|
||||
}); });
|
||||
});
|
||||
|
|
|
@ -158,7 +158,7 @@ angular.module('contactsApp')
|
|||
});
|
||||
};
|
||||
|
||||
this.create = function(newContact, addressBook, uid) {
|
||||
this.create = function(newContact, addressBook, uid, fromImport) {
|
||||
addressBook = addressBook || AddressBookService.getDefaultAddressBook();
|
||||
try {
|
||||
newContact = newContact || new Contact(addressBook);
|
||||
|
@ -187,8 +187,10 @@ angular.module('contactsApp')
|
|||
).then(function(xhr) {
|
||||
newContact.setETag(xhr.getResponseHeader('ETag'));
|
||||
contacts.put(newUid, newContact);
|
||||
notifyObservers('create', newUid);
|
||||
$('#details-fullName').select();
|
||||
if (fromImport !== true) {
|
||||
notifyObservers('create', newUid);
|
||||
$('#details-fullName').select();
|
||||
}
|
||||
return newContact;
|
||||
}).catch(function() {
|
||||
OC.Notification.showTemporary(t('contacts', 'Contact could not be created.'));
|
||||
|
@ -219,12 +221,16 @@ angular.module('contactsApp')
|
|||
num++;
|
||||
continue;
|
||||
}
|
||||
this.create(newContact, addressBook).then(function() {
|
||||
this.create(newContact, addressBook, '', true).then(function() {
|
||||
// Update the progress indicator
|
||||
if (progressCallback) {
|
||||
progressCallback(num / singleVCards.length);
|
||||
}
|
||||
num++;
|
||||
/* Import is over, let's notify */
|
||||
if(num === singleVCards.length) {
|
||||
notifyObservers('import');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue