events: Implement From<RoomPowerLevels> for PushConditionPowerLevelsCtx

This commit is contained in:
Kévin Commaille 2023-12-03 12:11:29 +01:00 committed by Kévin Commaille
parent 90d3605b87
commit df1a63909a
2 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@ Improvements:
- Don't fail event content parsing on invalid relation
- We previously already accepted custom or slightly malformed relations
- Now, even invalid / missing `rel_type` and `event_id` are accepted
- Implement `From<RoomPowerLevels>` for `ruma_common::push::PushConditionPowerLevelsCtx`
# 0.27.11

View File

@ -7,6 +7,7 @@ use std::{cmp::max, collections::BTreeMap};
use js_int::{int, Int};
use ruma_common::{
power_levels::{default_power_level, NotificationPowerLevels},
push::PushConditionPowerLevelsCtx,
OwnedUserId, RoomVersionId, UserId,
};
use ruma_macros::EventContent;
@ -500,6 +501,12 @@ impl From<RoomPowerLevels> for RoomPowerLevelsEventContent {
}
}
impl From<RoomPowerLevels> for PushConditionPowerLevelsCtx {
fn from(c: RoomPowerLevels) -> Self {
Self { users: c.users, users_default: c.users_default, notifications: c.notifications }
}
}
/// The actions that can be limited by power levels.
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]