summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-04 16:49:33 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-04 16:49:33 +0200
commitd33724ad749c191fd5cb0cc5da978fa35a6e33ab (patch)
tree41ac31ef75afa69767da318c5e78684568772b5f /js
parent23263da18276e47909b8b6a1d57fe6339ff3991f (diff)
parenta5d6164fe682d3d18915d73142d748a6a11c9cf1 (diff)
Merge pull request #331 from owncloud/fix-move-color-change
Prevent change of contact-color when changing a contacts adressbook, fix #243
Diffstat (limited to 'js')
-rw-r--r--js/services/contact_service.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/js/services/contact_service.js b/js/services/contact_service.js
index 01cd90d0..1511027c 100644
--- a/js/services/contact_service.js
+++ b/js/services/contact_service.js
@@ -76,10 +76,15 @@ angular.module('contactsApp')
}
};
- this.create = function(newContact, addressBook) {
+ this.create = function(newContact, addressBook, uid) {
addressBook = addressBook || AddressBookService.getDefaultAddressBook();
newContact = newContact || new Contact(addressBook);
- var newUid = uuid4.generate();
+ var newUid = '';
+ if(uuid4.validate(uid)) {
+ newUid = uid;
+ } else {
+ newUid = uuid4.generate();
+ }
newContact.uid(newUid);
newContact.setUrl(addressBook, newUid);
newContact.addressBookId = addressBook.displayName;
@@ -125,12 +130,13 @@ angular.module('contactsApp')
}
contact.syncVCard();
var clone = angular.copy(contact);
+ var uid = contact.uid();
- // create the contact in the new target addressbook
- this.create(clone, addressbook);
-
- // delete the old one
+ // delete the old one before to avoid conflict
this.delete(contact);
+
+ // create the contact in the new target addressbook
+ this.create(clone, addressbook, uid);
};
this.update = function(contact) {