mirror of
https://github.com/moparisthebest/mail
synced 2024-11-28 20:02:16 -05:00
deleting vinbox item after sync works
This commit is contained in:
parent
e5ed9c708c
commit
669d8002d2
@ -92,6 +92,29 @@ app.dao.CloudStorage = function(window, $) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete an encrypted item from the cloud
|
||||
* @param type [String] The type of item e.g. 'email'
|
||||
*/
|
||||
this.deleteEncryptedItem = function(id, type, emailAddress, folderName, callback) {
|
||||
var uri;
|
||||
|
||||
uri = app.config.cloudUrl + '/' + type + '/user/' + emailAddress + '/folder/' + folderName + '/' + id;
|
||||
$.ajax({
|
||||
url: uri,
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
callback();
|
||||
},
|
||||
error: function(xhr, textStatus, err) {
|
||||
callback({
|
||||
error: err,
|
||||
status: textStatus
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Lists the encrypted items
|
||||
* @param type [String] The type of item e.g. 'email'
|
||||
|
@ -133,13 +133,19 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, naclCrypto,
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: delete items from virtual inbox
|
||||
// delete asymmetricall encrypted item from virtual inbox
|
||||
deleteVinboxItem(asymCt, function(err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
after(); // asynchronously iterate through objects
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function asymDecryptMail(m, callback) {
|
||||
var pubKeyId = m.senderPk.split(';')[1];
|
||||
@ -184,6 +190,12 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, naclCrypto,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function deleteVinboxItem(email, callback) {
|
||||
cloudstorage.deleteEncryptedItem(email.id, 'email', self.account.get('emailAddress'), 'vinbox', function(err) {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user