From 7fa54e44113054818ad81030a988be08582c27d7 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 17 Jun 2021 20:14:37 +0200 Subject: [PATCH] Use Ruma-provided default power levels for shorter code --- src/client_server/account.rs | 12 +----------- src/client_server/room.rs | 10 +--------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/client_server/account.rs b/src/client_server/account.rs index f43f73e..2fc8b19 100644 --- a/src/client_server/account.rs +++ b/src/client_server/account.rs @@ -286,18 +286,8 @@ pub async fn register_route( event_type: EventType::RoomPowerLevels, content: serde_json::to_value( ruma::events::room::power_levels::PowerLevelsEventContent { - ban: 50.into(), - events: BTreeMap::new(), - events_default: 0.into(), - invite: 50.into(), - kick: 50.into(), - redact: 50.into(), - state_default: 50.into(), users, - users_default: 0.into(), - notifications: ruma::power_levels::NotificationPowerLevels { - room: 50.into(), - }, + ..Default::default() }, ) .expect("event is valid, we just created it"), diff --git a/src/client_server/room.rs b/src/client_server/room.rs index 72b2d60..3f91324 100644 --- a/src/client_server/room.rs +++ b/src/client_server/room.rs @@ -113,16 +113,8 @@ pub async fn create_room_route( let mut power_levels_content = serde_json::to_value(ruma::events::room::power_levels::PowerLevelsEventContent { - ban: 50.into(), - events: BTreeMap::new(), - events_default: 0.into(), - invite: 50.into(), - kick: 50.into(), - redact: 50.into(), - state_default: 50.into(), users, - users_default: 0.into(), - notifications: ruma::power_levels::NotificationPowerLevels { room: 50.into() }, + ..Default::default() }) .expect("event is valid, we just created it");