mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-16 05:36:50 +00:00
Room deletion (fixes #43)
This commit is contained in:
1 parent
7a3496869b
commit
d05d3f710f
15 files changed
+447
-7
No files matched your search
@@ -9,12 +9,13 @@ use serde_json::json;
|
||||
use tuwunel_core::{
|
||||
Event, Result, err,
|
||||
matrix::pdu::{PduCount, PduEvent, PduId, RawPduId},
|
||||
trace,
|
||||
utils::{
|
||||
ReadyExt,
|
||||
stream::{TryIgnore, WidebandExt},
|
||||
},
|
||||
};
|
||||
use tuwunel_database::{Deserialized, Map};
|
||||
use tuwunel_database::{Deserialized, Interfix, Map};
|
||||
|
||||
pub struct Service {
|
||||
db: Data,
|
||||
@@ -191,4 +192,20 @@ impl Service {
|
||||
.await
|
||||
.deserialized()
|
||||
}
|
||||
|
||||
pub(super) async fn delete_all_rooms_threads(&self, room_id: &RoomId) -> Result {
|
||||
let prefix = (room_id, Interfix);
|
||||
|
||||
self.db
|
||||
.threadid_userids
|
||||
.keys_prefix_raw(&prefix)
|
||||
.ignore_err()
|
||||
.ready_for_each(|key| {
|
||||
trace!("Removing key: {key:?}");
|
||||
self.db.threadid_userids.remove(key);
|
||||
})
|
||||
.await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user