unfinished untested impl of room deletion

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry
2024-02-20 22:40:46 -05:00
parent 0593dce8a6
commit a94bf2cf9f
31 changed files with 400 additions and 9 deletions
+13
View File
@@ -1,6 +1,7 @@
use std::mem;
use ruma::{api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId};
use tracing::debug;
use crate::{database::KeyValueDatabase, service, services, utils, Error, PduEvent, Result};
@@ -47,6 +48,18 @@ impl service::rooms::threads::Data for KeyValueDatabase {
))
}
fn delete_all_rooms_threads(&self, room_id: &RoomId) -> Result<()> {
let mut prefix = room_id.as_bytes().to_vec();
prefix.push(0xff);
for (key, _) in self.threadid_userids.scan_prefix(prefix) {
debug!("Removing key: {:?}", key);
self.threadid_userids.remove(&key)?;
}
Ok(())
}
fn update_participants(&self, root_id: &[u8], participants: &[OwnedUserId]) -> Result<()> {
let users = participants
.iter()