events: Add {RoomRedactionEvent, SyncRoomRedactionEvent}::as_original
This commit is contained in:
parent
d0faeb52f3
commit
dd24d6be77
@ -230,6 +230,14 @@ impl RoomRedactionEvent {
|
||||
Self::Redacted(ev) => &ev.room_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the inner `RoomRedactionEvent` if this is an unredacted event.
|
||||
pub fn as_original(&self) -> Option<&OriginalRoomRedactionEvent> {
|
||||
match self {
|
||||
Self::Original(v) => Some(v),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Redact for RoomRedactionEvent {
|
||||
@ -292,6 +300,14 @@ impl SyncRoomRedactionEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the inner `SyncRoomRedactionEvent` if this is an unredacted event.
|
||||
pub fn as_original(&self) -> Option<&OriginalSyncRoomRedactionEvent> {
|
||||
match self {
|
||||
Self::Original(v) => Some(v),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert this sync event into a full event (one with a `room_id` field).
|
||||
pub fn into_full_event(self, room_id: Box<RoomId>) -> RoomRedactionEvent {
|
||||
match self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user