Fix unstable-pre-spec for federation membership join

This commit is contained in:
Devin Ragotzy 2020-10-27 18:44:29 -04:00
parent 11e8856a91
commit 26b0f738a5
3 changed files with 13 additions and 6 deletions

View File

@ -23,9 +23,10 @@ thiserror = "1.0.20"
tracing-subscriber = "0.2.11" tracing-subscriber = "0.2.11"
[dependencies.ruma] [dependencies.ruma]
git = "https://github.com/ruma/ruma" # git = "https://github.com/ruma/ruma"
rev = "8049631827ab8557cb1010d195dd6468f90effa8" path = "../__forks__/ruma/ruma"
features = ["client-api", "federation-api", "appservice-api"] # rev = "64b9c646d15a359d62ab464a95176ff94adb2554"
features = ["client-api", "federation-api", "appservice-api", "unstable-pre-spec", "unstable-synapse-quirks"]
#[dependencies.ruma] #[dependencies.ruma]
#path = "../ruma/ruma" #path = "../ruma/ruma"

View File

@ -125,7 +125,12 @@ impl StateEvent {
Self::Full(ev) => match ev { Self::Full(ev) => match ev {
Pdu::RoomV1Pdu(ev) => ev.event_id.clone(), Pdu::RoomV1Pdu(ev) => ev.event_id.clone(),
Pdu::RoomV3Pdu(ev) => { Pdu::RoomV3Pdu(ev) => {
let value = serde_json::to_value(ev).expect("all ruma pdus are json values"); let mut value = serde_json::from_slice::<BTreeMap<_, _>>(
&serde_json::to_vec(ev).expect("all ruma pdus are json values"),
)
.unwrap();
value.remove("event_id");
EventId::try_from(&*format!( EventId::try_from(&*format!(
"${}", "${}",
ruma::signatures::reference_hash(&value, &self.room_version()) ruma::signatures::reference_hash(&value, &self.room_version())
@ -195,7 +200,8 @@ impl StateEvent {
PduStub::RoomV1PduStub(ev) => ev.state_key.clone(), PduStub::RoomV1PduStub(ev) => ev.state_key.clone(),
PduStub::RoomV3PduStub(ev) => ev.state_key.clone(), PduStub::RoomV3PduStub(ev) => ev.state_key.clone(),
}, },
}.expect("All state events have a state key") }
.expect("All state events have a state key")
} }
#[cfg(not(feature = "unstable-pre-spec"))] #[cfg(not(feature = "unstable-pre-spec"))]

View File

@ -31,7 +31,7 @@ pub trait StateStore {
result.push(ev_id.clone()); result.push(ev_id.clone());
let event = self.get_event(room_id, &ev_id).unwrap(); let event = self.get_event(room_id, &ev_id)?;
stack.extend(event.auth_events()); stack.extend(event.auth_events());
} }