Use Ruma-provided default power levels for shorter code

next
Jonas Platte 2021-06-17 20:14:37 +02:00
parent f6046871f4
commit 7fa54e4411
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 2 additions and 20 deletions

View File

@ -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"),

View File

@ -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");