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

Check for dupes when renaming group. Fixes #359

This commit is contained in:
Thomas Tanghus 2014-01-23 11:50:24 +01:00
parent e22d39aa10
commit 54d79ae751

View File

@ -519,6 +519,13 @@ OC.Contacts = OC.Contacts || {};
addText: t('contacts', 'Save'),
ok: function(event, newname) {
console.log('New name', newname);
if(self.hasGroup(newname)) {
$(document).trigger('status.contacts.error', {
error: true,
message: t('contacts', 'A group named "{group}" already exists', {group: escapeHTML(newname)})
});
return;
}
$editInput.addClass('loading');
self.renameGroup(oldname, newname, function(response) {
if(response.error) {
@ -595,7 +602,7 @@ OC.Contacts = OC.Contacts || {};
var self = this;
if(this.hasGroup(name)) {
if(typeof cb === 'function') {
cb({error:true, message:t('contacts', 'A group named {group} already exists', {group: escapeHTML(name)})});
cb({error:true, message:t('contacts', 'A group named "{group} a"lready exists', {group: escapeHTML(name)})});
}
return;
}