diff --git a/crates/ruma-common/src/events/room/power_levels.rs b/crates/ruma-common/src/events/room/power_levels.rs index 2591ab9a..4e253400 100644 --- a/crates/ruma-common/src/events/room/power_levels.rs +++ b/crates/ruma-common/src/events/room/power_levels.rs @@ -171,6 +171,16 @@ fn is_default_power_level(l: &Int) -> bool { *l == int!(50) } +impl RoomPowerLevelsEvent { + /// Obtain the effective power levels, regardless of whether this event is redacted. + pub fn power_levels(&self) -> RoomPowerLevels { + match self { + Self::Original(ev) => ev.content.clone().into(), + Self::Redacted(ev) => ev.content.clone().into(), + } + } +} + /// The effective power levels of a room. /// /// This struct contains the same fields as [`RoomPowerLevelsEventContent`] and be created from that