1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Contacts: If a group is selected when adding a contact add it to that group.

This commit is contained in:
Thomas Tanghus 2012-12-14 02:47:51 +01:00
parent b05a123289
commit 7b6924e44d

View File

@ -403,6 +403,20 @@ OC.Contacts = OC.Contacts || {};
self.id = parseInt(jsondata.data.id);
self.access.id = parseInt(jsondata.data.aid);
self.data = jsondata.data.details;
// Add contact to current group
if(self.groupprops && self.groupprops.currentgroup.name !== 'all'
&& self.groupprops.currentgroup.name !== 'fav') {
if(!self.data.CATEGORIES) {
self.data.CATEGORIES = [{value:[self.groupprops.currentgroup.name], parameters:[]}];
// Save to vCard
self.saveProperty({name:'CATEGORIES', value:self.data.CATEGORIES[0].value.join(',') });
// Tell OC.Contacts to save in backend
$(document).trigger('request.contact.addtogroup', {
id: self.id,
groupid: self.groupprops.currentgroup.id,
});
}
}
$(document).trigger('status.contact.added', {
id: self.id,
contact: self,