events: Add conversion from RoomPowerLevels to RoomPowerLvelsEventContent

This commit is contained in:
Johannes Becker 2022-04-21 12:29:56 +02:00 committed by GitHub
parent 3a47403a75
commit 6b768dc033
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -34,6 +34,7 @@ Improvements:
* Add unstable support for threads (MSC3440)
* Add `ReceiptEventContent::user_receipt`
* Make `Restricted::allow` public
* Conversion from `RoomPowerLevels` to `RoomPowerLevelsEventContent`
# 0.8.0

View File

@ -284,6 +284,23 @@ impl From<RedactedRoomPowerLevelsEventContent> for RoomPowerLevels {
}
}
impl From<RoomPowerLevels> for RoomPowerLevelsEventContent {
fn from(c: RoomPowerLevels) -> Self {
Self {
ban: c.ban,
events: c.events,
events_default: c.events_default,
invite: c.invite,
kick: c.kick,
redact: c.redact,
state_default: c.state_default,
users: c.users,
users_default: c.users_default,
notifications: c.notifications,
}
}
}
#[cfg(test)]
mod tests {
use std::collections::BTreeMap;