mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 05:26:59 +00:00
fix: detach rather than delete emoji during server deletion
This commit is contained in:
@@ -214,14 +214,21 @@ impl MongoDb {
|
||||
|
||||
// Delete all emoji.
|
||||
self.col::<Document>("emojis")
|
||||
.delete_many(
|
||||
.update_many(
|
||||
doc! {
|
||||
"parent.id": &server_id
|
||||
},
|
||||
doc! {
|
||||
"$set": {
|
||||
"parent": {
|
||||
"type": "Detached"
|
||||
}
|
||||
}
|
||||
},
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.map_err(|_| create_database_error!("delete_many", "emojis"))?;
|
||||
.map_err(|_| create_database_error!("update_many", "emojis"))?;
|
||||
|
||||
// Delete all channels.
|
||||
self.col::<Document>("channels")
|
||||
|
||||
Reference in New Issue
Block a user