1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-31 18:31:00 +00:00

KvTree: asyncify clear and increment

This commit is contained in:
chayleaf 2024-06-22 21:22:43 +07:00
parent a8c9e3eebe
commit 7658414fc4
No known key found for this signature in database
GPG key ID: 78171AD46227E68E
62 changed files with 958 additions and 650 deletions

View file

@ -639,19 +639,22 @@ impl Service {
.set_displayname(&user_id, Some(displayname))?;
// Initial account data
services().account_data.update(
None,
&user_id,
ruma::events::GlobalAccountDataEventType::PushRules
.to_string()
.into(),
&serde_json::to_value(ruma::events::push_rules::PushRulesEvent {
content: ruma::events::push_rules::PushRulesEventContent {
global: ruma::push::Ruleset::server_default(&user_id),
},
})
.expect("to json value always works"),
)?;
services()
.account_data
.update(
None,
&user_id,
ruma::events::GlobalAccountDataEventType::PushRules
.to_string()
.into(),
&serde_json::to_value(ruma::events::push_rules::PushRulesEvent {
content: ruma::events::push_rules::PushRulesEventContent {
global: ruma::push::Ruleset::server_default(&user_id),
},
})
.expect("to json value always works"),
)
.await?;
// we dont add a device since we're not the user, just the creator
@ -704,7 +707,7 @@ impl Service {
"Making {user_id} leave all rooms before deactivation..."
));
services().users.deactivate_account(&user_id)?;
services().users.deactivate_account(&user_id).await?;
if leave_rooms {
leave_all_rooms(&user_id).await?;
@ -800,7 +803,7 @@ impl Service {
}
for &user_id in &user_ids {
if services().users.deactivate_account(user_id).is_ok() {
if services().users.deactivate_account(user_id).await.is_ok() {
deactivation_count += 1
}
}
@ -1057,7 +1060,11 @@ impl Service {
pub(crate) async fn create_admin_room(&self) -> Result<()> {
let room_id = RoomId::new(services().globals.server_name());
services().rooms.short.get_or_create_shortroomid(&room_id)?;
services()
.rooms
.short
.get_or_create_shortroomid(&room_id)
.await?;
let mutex_state = Arc::clone(
services()
@ -1293,7 +1300,8 @@ impl Service {
services()
.rooms
.alias
.set_alias(&alias, &room_id, conduit_user)?;
.set_alias(&alias, &room_id, conduit_user)
.await?;
Ok(())
}