summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-08-23 16:39:25 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-08-23 22:03:35 +0200
commitfdb4c820d3eef655e893a21dbd1d0b18ee30dc60 (patch)
treef1e297846925c31c263f298fa7afbf7d839ff5c6 /apps
parent394617e0b6911d889f361f0747cd8f4f7ebe7a39 (diff)
downloadnextcloud-server-fdb4c820d3eef655e893a21dbd1d0b18ee30dc60.tar.gz
nextcloud-server-fdb4c820d3eef655e893a21dbd1d0b18ee30dc60.zip
Fix for deleting queued contacts.
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/js/contacts.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index e5daadb6d1d..a6262349df9 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -471,7 +471,7 @@ OC.Contacts={
}
$('#rightcontent').data('id', newid);
- OC.Contacts.Contacts.deletionQueue.push(this.id);
+ OC.Contacts.Contacts.deletionQueue.push(parseInt(this.id));
if(!window.onbeforeunload) {
window.onbeforeunload = OC.Contacts.Contacts.warnNotDeleted;
}
@@ -497,7 +497,9 @@ OC.Contacts={
OC.Contacts.notify({
data:curlistitem,
message:t('contacts','Click to undo deletion of "') + curlistitem.find('a').text() + '"',
+ timeout:5,
timeouthandler:function(contact) {
+ console.log('timeout');
OC.Contacts.Card.doDelete(contact.data('id'), true);
delete contact;
},
@@ -509,19 +511,25 @@ OC.Contacts={
});
},
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;
}
$.post(OC.filePath('contacts', 'ajax', 'contact/delete.php'),{'id':id},function(jsondata) {
if(jsondata.status == 'error'){
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
- if(removeFromQueue) {
- OC.Contacts.Contacts.deletionQueue.splice(OC.Contacts.Contacts.deletionQueue.indexOf(id), 1);
- }
- if(OC.Contacts.Contacts.deletionQueue.length == 0) {
- window.onbeforeunload = null;
- }
+ updateQueue(id, removeFromQueue);
});
},
loadContact:function(jsondata, bookid){