events: Add {RoomHistoryVisibilityEvent, SyncRoomHistoryVisibilityEvent}::history_visibility

This commit is contained in:
Jonas Platte 2022-04-13 15:33:05 +02:00
parent 16f2021c59
commit ea832d0c45
No known key found for this signature in database
GPG Key ID: BBA95679259D342F

View File

@ -27,6 +27,26 @@ impl RoomHistoryVisibilityEventContent {
}
}
impl RoomHistoryVisibilityEvent {
/// Obtain the history visibility, regardless of whether this event is redacted.
pub fn history_visibility(&self) -> &HistoryVisibility {
match self {
Self::Original(ev) => &ev.content.history_visibility,
Self::Redacted(ev) => &ev.content.history_visibility,
}
}
}
impl SyncRoomHistoryVisibilityEvent {
/// Obtain the history visibility, regardless of whether this event is redacted.
pub fn history_visibility(&self) -> &HistoryVisibility {
match self {
Self::Original(ev) => &ev.content.history_visibility,
Self::Redacted(ev) => &ev.content.history_visibility,
}
}
}
/// Who can see a room's history.
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)]