mirror of https://github.com/nextcloud/contacts
Only select nearest contact if not in the list
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
7f82451241
commit
1a41481649
|
@ -104,7 +104,12 @@ angular.module('contactsApp')
|
|||
ContactService.getAll().then(function(contacts) {
|
||||
ctrl.contactList = contacts;
|
||||
ctrl.loading = false;
|
||||
ctrl.selectNearestContact(ctrl.getSelectedId());
|
||||
// Only change contact if the selectd one is not in the list anymore
|
||||
if(ctrl.contactList.findIndex(function(contact) {
|
||||
return contact.uid() === ctrl.getSelectedId();
|
||||
}) === -1) {
|
||||
ctrl.selectNearestContact(ctrl.getSelectedId());
|
||||
}
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue