Undelete: deleted files, calendar events, contacts and Sieve scripts are kept and restored where they were (UD-1, UD-8 to UD-11)
Files, events and contacts are noted when deleted for good and archived by the unindex task when retention is on; Sieve scripts are archived at deletion. A restore goes back to its folder, calendar or address book if it still exists, takes a free " (restored)" name, comes back inactive for scripts, and is refused over quota with the item left archived. Acceptance tests 6, 8 and 12.
This commit is contained in:
@@ -42,6 +42,33 @@ impl SieveScriptDelete for Server {
|
||||
))
|
||||
.await?
|
||||
{
|
||||
// inbuxa: UD-1: a deleted script is kept, when archiving is on
|
||||
if let Some(retention) =
|
||||
inbuxa_features::undelete::settings::retention(self.registry())
|
||||
.await?
|
||||
.items
|
||||
{
|
||||
let script = obj_
|
||||
.deserialize::<SieveScript>()
|
||||
.caused_by(trc::location!())?;
|
||||
let content = self
|
||||
.blob_store()
|
||||
.get_blob(script.blob_hash.as_slice(), 0..usize::MAX)
|
||||
.await?
|
||||
.map(|bytes| String::from_utf8_lossy(&bytes).into_owned())
|
||||
.unwrap_or_default();
|
||||
inbuxa_features::undelete::groupware::archive_sieve(
|
||||
&self.core.storage.data,
|
||||
self.registry(),
|
||||
account_id,
|
||||
&script.name,
|
||||
content,
|
||||
script.blob_hash.clone(),
|
||||
retention,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
// Delete record
|
||||
batch
|
||||
.with_account_id(account_id)
|
||||
|
||||
Reference in New Issue
Block a user