Update how PDU works this needs to be fixed TODO

I have just added a hack to make the Pdu deserialize correctly in the
tests this has to be fixed!!
This commit is contained in:
Devin Ragotzy 2020-08-11 23:53:33 -04:00
parent 1509ef45c1
commit 5a45970266
4 changed files with 52 additions and 1 deletions

View File

@ -14,6 +14,7 @@ use criterion::{criterion_group, criterion_main, Criterion};
use maplit::btreemap;
use ruma::{
events::{
pdu::EventHash,
room::{
join_rules::JoinRule,
member::{MemberEventContent, MembershipState},
@ -388,11 +389,27 @@ where
.iter()
.map(AsRef::as_ref)
.map(event_id)
.map(|id| {
(
id,
EventHash {
sha256: "hello".into(),
},
)
})
.collect::<Vec<_>>();
let prev_events = prev_events
.iter()
.map(AsRef::as_ref)
.map(event_id)
.map(|id| {
(
id,
EventHash {
sha256: "hello".into(),
},
)
})
.collect::<Vec<_>>();
let json = if let Some(state_key) = state_key {

View File

@ -266,7 +266,7 @@ impl<'de> de::Deserialize<'de> for StateEvent {
Some(unsigned) if unsigned.redacted_because.is_some() => {
panic!("TODO deal with redacted events")
}
_ => StateEvent::Full(from_raw_json_value(&json)?),
_ => StateEvent::Full(Pdu::RoomV1Pdu(from_raw_json_value(&json)?)),
})
} else {
Ok(match unsigned {

View File

@ -10,6 +10,7 @@ use std::{
use ruma::{
events::{
pdu::EventHash,
room::{
join_rules::JoinRule,
member::{MemberEventContent, MembershipState},
@ -360,11 +361,27 @@ where
.iter()
.map(AsRef::as_ref)
.map(event_id)
.map(|id| {
(
id,
EventHash {
sha256: "hello".into(),
},
)
})
.collect::<Vec<_>>();
let prev_events = prev_events
.iter()
.map(AsRef::as_ref)
.map(event_id)
.map(|id| {
(
id,
EventHash {
sha256: "hello".into(),
},
)
})
.collect::<Vec<_>>();
let json = if let Some(state_key) = state_key {

View File

@ -10,6 +10,7 @@ use std::{
use maplit::btreemap;
use ruma::{
events::{
pdu::EventHash,
room::{
join_rules::JoinRule,
member::{MemberEventContent, MembershipState},
@ -103,11 +104,27 @@ where
.iter()
.map(AsRef::as_ref)
.map(event_id)
.map(|id| {
(
id,
EventHash {
sha256: "hello".into(),
},
)
})
.collect::<Vec<_>>();
let prev_events = prev_events
.iter()
.map(AsRef::as_ref)
.map(event_id)
.map(|id| {
(
id,
EventHash {
sha256: "hello".into(),
},
)
})
.collect::<Vec<_>>();
let json = if let Some(state_key) = state_key {