improvement: better default push rules

This commit is contained in:
timokoesters 2020-06-12 13:18:25 +02:00
parent e7803e310a
commit 02fe030b2a
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
5 changed files with 359 additions and 80 deletions

View file

@ -4,6 +4,7 @@ use ruma::{
api::federation::EventHash,
events::{
collections::all::{RoomEvent, StateEvent},
room::member::MemberEvent,
stripped::AnyStrippedStateEvent,
EventJson, EventType,
},
@ -95,4 +96,9 @@ impl PduEvent {
serde_json::from_str::<EventJson<AnyStrippedStateEvent>>(&json)
.expect("EventJson::from_str always works")
}
pub fn to_member_event(&self) -> EventJson<MemberEvent> {
let json = serde_json::to_string(&self).expect("PDUs are always valid");
serde_json::from_str::<EventJson<MemberEvent>>(&json)
.expect("EventJson::from_str always works")
}
}