Store vanished IMAP UIDs and WebDAV paths
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
use crate::DestroyArchive;
|
||||
use common::{Server, auth::AccessToken, storage::index::ObjectIndexBuilder};
|
||||
use jmap_proto::types::collection::Collection;
|
||||
use jmap_proto::types::collection::{Collection, VanishedCollection};
|
||||
use store::write::{Archive, BatchBuilder, now};
|
||||
use trc::AddContext;
|
||||
|
||||
@@ -132,6 +132,7 @@ impl Calendar {
|
||||
}
|
||||
|
||||
impl DestroyArchive<Archive<&ArchivedCalendar>> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn delete_with_events(
|
||||
self,
|
||||
server: &Server,
|
||||
@@ -139,6 +140,7 @@ impl DestroyArchive<Archive<&ArchivedCalendar>> {
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
children_ids: Vec<u32>,
|
||||
delete_path: Option<String>,
|
||||
batch: &mut BatchBuilder,
|
||||
) -> trc::Result<()> {
|
||||
// Process deletions
|
||||
@@ -158,12 +160,13 @@ impl DestroyArchive<Archive<&ArchivedCalendar>> {
|
||||
account_id,
|
||||
document_id,
|
||||
calendar_id,
|
||||
None,
|
||||
batch,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
self.delete(access_token, account_id, document_id, batch)
|
||||
self.delete(access_token, account_id, document_id, delete_path, batch)
|
||||
}
|
||||
|
||||
pub fn delete(
|
||||
@@ -171,6 +174,7 @@ impl DestroyArchive<Archive<&ArchivedCalendar>> {
|
||||
access_token: &AccessToken,
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
delete_path: Option<String>,
|
||||
batch: &mut BatchBuilder,
|
||||
) -> trc::Result<()> {
|
||||
let calendar = self.0;
|
||||
@@ -184,8 +188,11 @@ impl DestroyArchive<Archive<&ArchivedCalendar>> {
|
||||
.with_tenant_id(access_token)
|
||||
.with_current(calendar),
|
||||
)
|
||||
.caused_by(trc::location!())?
|
||||
.commit_point();
|
||||
.caused_by(trc::location!())?;
|
||||
if let Some(delete_path) = delete_path {
|
||||
batch.log_vanished_item(VanishedCollection::Calendar, delete_path);
|
||||
}
|
||||
batch.commit_point();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -198,6 +205,7 @@ impl DestroyArchive<Archive<&ArchivedCalendarEvent>> {
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
calendar_id: u32,
|
||||
delete_path: Option<String>,
|
||||
batch: &mut BatchBuilder,
|
||||
) -> trc::Result<()> {
|
||||
let event = self.0;
|
||||
@@ -238,6 +246,10 @@ impl DestroyArchive<Archive<&ArchivedCalendarEvent>> {
|
||||
.caused_by(trc::location!())?;
|
||||
}
|
||||
|
||||
if let Some(delete_path) = delete_path {
|
||||
batch.log_vanished_item(VanishedCollection::Calendar, delete_path);
|
||||
}
|
||||
|
||||
batch.commit_point();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
use common::{Server, auth::AccessToken, storage::index::ObjectIndexBuilder};
|
||||
use jmap_proto::types::collection::Collection;
|
||||
use jmap_proto::types::collection::{Collection, VanishedCollection};
|
||||
use store::write::{Archive, BatchBuilder, now};
|
||||
use trc::AddContext;
|
||||
|
||||
@@ -123,6 +123,7 @@ impl AddressBook {
|
||||
}
|
||||
|
||||
impl DestroyArchive<Archive<&ArchivedAddressBook>> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn delete_with_cards(
|
||||
self,
|
||||
server: &Server,
|
||||
@@ -130,6 +131,7 @@ impl DestroyArchive<Archive<&ArchivedAddressBook>> {
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
children_ids: Vec<u32>,
|
||||
delete_path: Option<String>,
|
||||
batch: &mut BatchBuilder,
|
||||
) -> trc::Result<()> {
|
||||
// Process deletions
|
||||
@@ -149,12 +151,13 @@ impl DestroyArchive<Archive<&ArchivedAddressBook>> {
|
||||
account_id,
|
||||
document_id,
|
||||
addressbook_id,
|
||||
None,
|
||||
batch,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
self.delete(access_token, account_id, document_id, batch)
|
||||
self.delete(access_token, account_id, document_id, delete_path, batch)
|
||||
}
|
||||
|
||||
pub fn delete(
|
||||
@@ -162,6 +165,7 @@ impl DestroyArchive<Archive<&ArchivedAddressBook>> {
|
||||
access_token: &AccessToken,
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
delete_path: Option<String>,
|
||||
batch: &mut BatchBuilder,
|
||||
) -> trc::Result<()> {
|
||||
let book = self.0;
|
||||
@@ -175,8 +179,13 @@ impl DestroyArchive<Archive<&ArchivedAddressBook>> {
|
||||
.with_tenant_id(access_token)
|
||||
.with_current(book),
|
||||
)
|
||||
.caused_by(trc::location!())?
|
||||
.commit_point();
|
||||
.caused_by(trc::location!())?;
|
||||
|
||||
if let Some(delete_path) = delete_path {
|
||||
batch.log_vanished_item(VanishedCollection::AddressBook, delete_path);
|
||||
}
|
||||
|
||||
batch.commit_point();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -189,6 +198,7 @@ impl DestroyArchive<Archive<&ArchivedContactCard>> {
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
addressbook_id: u32,
|
||||
delete_path: Option<String>,
|
||||
batch: &mut BatchBuilder,
|
||||
) -> trc::Result<()> {
|
||||
let card = self.0;
|
||||
@@ -229,6 +239,10 @@ impl DestroyArchive<Archive<&ArchivedContactCard>> {
|
||||
.caused_by(trc::location!())?;
|
||||
}
|
||||
|
||||
if let Some(delete_path) = delete_path {
|
||||
batch.log_vanished_item(VanishedCollection::AddressBook, delete_path);
|
||||
}
|
||||
|
||||
batch.commit_point();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
use common::{Server, auth::AccessToken, storage::index::ObjectIndexBuilder};
|
||||
use jmap_proto::types::collection::Collection;
|
||||
use jmap_proto::types::collection::{Collection, VanishedCollection};
|
||||
use store::write::{Archive, BatchBuilder, now};
|
||||
use trc::AddContext;
|
||||
|
||||
@@ -71,6 +71,7 @@ impl DestroyArchive<Archive<&ArchivedFileNode>> {
|
||||
account_id: u32,
|
||||
document_id: u32,
|
||||
batch: &mut BatchBuilder,
|
||||
path: String,
|
||||
) -> trc::Result<()> {
|
||||
// Prepare write batch
|
||||
batch
|
||||
@@ -82,6 +83,7 @@ impl DestroyArchive<Archive<&ArchivedFileNode>> {
|
||||
.with_current(self.0)
|
||||
.with_tenant_id(access_token),
|
||||
)?
|
||||
.log_vanished_item(VanishedCollection::FileNode, path)
|
||||
.commit_point();
|
||||
Ok(())
|
||||
}
|
||||
@@ -93,6 +95,7 @@ impl DestroyArchive<Vec<u32>> {
|
||||
server: &Server,
|
||||
access_token: &AccessToken,
|
||||
account_id: u32,
|
||||
delete_path: Option<String>,
|
||||
) -> trc::Result<()> {
|
||||
// Process deletions
|
||||
let mut batch = BatchBuilder::new();
|
||||
@@ -122,6 +125,9 @@ impl DestroyArchive<Vec<u32>> {
|
||||
|
||||
// Write changes
|
||||
if !batch.is_empty() {
|
||||
if let Some(delete_path) = delete_path {
|
||||
batch.log_vanished_item(VanishedCollection::FileNode, delete_path);
|
||||
}
|
||||
server
|
||||
.commit_batch(batch)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user