Fix for deleting queued contacts.
This commit is contained in:
parent
394617e0b6
commit
fdb4c820d3
|
@ -471,7 +471,7 @@ OC.Contacts={
|
||||||
}
|
}
|
||||||
$('#rightcontent').data('id', newid);
|
$('#rightcontent').data('id', newid);
|
||||||
|
|
||||||
OC.Contacts.Contacts.deletionQueue.push(this.id);
|
OC.Contacts.Contacts.deletionQueue.push(parseInt(this.id));
|
||||||
if(!window.onbeforeunload) {
|
if(!window.onbeforeunload) {
|
||||||
window.onbeforeunload = OC.Contacts.Contacts.warnNotDeleted;
|
window.onbeforeunload = OC.Contacts.Contacts.warnNotDeleted;
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,9 @@ OC.Contacts={
|
||||||
OC.Contacts.notify({
|
OC.Contacts.notify({
|
||||||
data:curlistitem,
|
data:curlistitem,
|
||||||
message:t('contacts','Click to undo deletion of "') + curlistitem.find('a').text() + '"',
|
message:t('contacts','Click to undo deletion of "') + curlistitem.find('a').text() + '"',
|
||||||
|
timeout:5,
|
||||||
timeouthandler:function(contact) {
|
timeouthandler:function(contact) {
|
||||||
|
console.log('timeout');
|
||||||
OC.Contacts.Card.doDelete(contact.data('id'), true);
|
OC.Contacts.Card.doDelete(contact.data('id'), true);
|
||||||
delete contact;
|
delete contact;
|
||||||
},
|
},
|
||||||
|
@ -509,19 +511,25 @@ OC.Contacts={
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
doDelete:function(id, removeFromQueue) {
|
doDelete:function(id, removeFromQueue) {
|
||||||
if(OC.Contacts.Contacts.deletionQueue.indexOf(id) == -1 && removeFromQueue) {
|
var updateQueue = function(id, remove) {
|
||||||
|
if(removeFromQueue) {
|
||||||
|
OC.Contacts.Contacts.deletionQueue.splice(OC.Contacts.Contacts.deletionQueue.indexOf(parseInt(id)), 1);
|
||||||
|
}
|
||||||
|
if(OC.Contacts.Contacts.deletionQueue.length == 0) {
|
||||||
|
window.onbeforeunload = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OC.Contacts.Contacts.deletionQueue.indexOf(parseInt(id)) == -1 && removeFromQueue) {
|
||||||
|
console.log('returning');
|
||||||
|
updateQueue(id, removeFromQueue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.post(OC.filePath('contacts', 'ajax', 'contact/delete.php'),{'id':id},function(jsondata) {
|
$.post(OC.filePath('contacts', 'ajax', 'contact/delete.php'),{'id':id},function(jsondata) {
|
||||||
if(jsondata.status == 'error'){
|
if(jsondata.status == 'error'){
|
||||||
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
|
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
|
||||||
}
|
}
|
||||||
if(removeFromQueue) {
|
updateQueue(id, removeFromQueue);
|
||||||
OC.Contacts.Contacts.deletionQueue.splice(OC.Contacts.Contacts.deletionQueue.indexOf(id), 1);
|
|
||||||
}
|
|
||||||
if(OC.Contacts.Contacts.deletionQueue.length == 0) {
|
|
||||||
window.onbeforeunload = null;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadContact:function(jsondata, bookid){
|
loadContact:function(jsondata, bookid){
|
||||||
|
|
Loading…
Reference in New Issue