Only push out status; mark attachments as deleted.

This commit is contained in:
Paul
2021-04-28 17:12:14 +01:00
parent f163cb65de
commit 81002c75d2
4 changed files with 85 additions and 8 deletions

View File

@@ -276,6 +276,26 @@ impl Message {
.await
.ok();
if let Some(attachment) = &self.attachment {
get_collection("attachments")
.update_one(
doc! {
"_id": &attachment.id
},
doc! {
"$set": {
"deleted": true
}
},
None
)
.await
.map_err(|_| Error::DatabaseError {
operation: "update_one",
with: "attachment",
})?;
}
Ok(())
}
}