fix: Don't include origin in remote memberships

This commit is contained in:
timedout
2026-03-29 14:18:13 +01:00
parent 053860e496
commit 303ad4ab9c
2 changed files with 2 additions and 19 deletions
-5
View File
@@ -409,11 +409,6 @@ async fn knock_room_helper_local(
room_id, room_id,
&knock_event_stub, &knock_event_stub,
)?; )?;
knock_event_stub.insert(
"origin".to_owned(),
CanonicalJsonValue::String(services.globals.server_name().as_str().to_owned()),
);
knock_event_stub.insert( knock_event_stub.insert(
"origin_server_ts".to_owned(), "origin_server_ts".to_owned(),
CanonicalJsonValue::Integer( CanonicalJsonValue::Integer(
+2 -14
View File
@@ -9,7 +9,7 @@ use conduwuit::{
}; };
use futures::{FutureExt, StreamExt, pin_mut}; use futures::{FutureExt, StreamExt, pin_mut};
use ruma::{ use ruma::{
CanonicalJsonObject, CanonicalJsonValue, OwnedServerName, RoomId, RoomVersionId, UserId, CanonicalJsonObject, CanonicalJsonValue, OwnedServerName, RoomId, UserId,
api::{ api::{
client::membership::leave_room, client::membership::leave_room,
federation::{self}, federation::{self},
@@ -337,6 +337,7 @@ pub async fn remote_leave_room<S: ::std::hash::BuildHasher>(
"Invalid make_leave event json received from {remote_server} for {room_id}: {e:?}" "Invalid make_leave event json received from {remote_server} for {room_id}: {e:?}"
))) )))
})?; })?;
leave_event_stub.remove("event_id");
validate_remote_member_event_stub( validate_remote_member_event_stub(
&MembershipState::Leave, &MembershipState::Leave,
@@ -345,11 +346,6 @@ pub async fn remote_leave_room<S: ::std::hash::BuildHasher>(
&leave_event_stub, &leave_event_stub,
)?; )?;
// TODO: Is origin needed?
leave_event_stub.insert(
"origin".to_owned(),
CanonicalJsonValue::String(services.globals.server_name().as_str().to_owned()),
);
leave_event_stub.insert( leave_event_stub.insert(
"origin_server_ts".to_owned(), "origin_server_ts".to_owned(),
CanonicalJsonValue::Integer( CanonicalJsonValue::Integer(
@@ -365,14 +361,6 @@ pub async fn remote_leave_room<S: ::std::hash::BuildHasher>(
} }
} }
// room v3 and above removed the "event_id" field from remote PDU format
match room_version_id {
| RoomVersionId::V1 | RoomVersionId::V2 => {},
| _ => {
leave_event_stub.remove("event_id");
},
}
// In order to create a compatible ref hash (EventID) the `hashes` field needs // In order to create a compatible ref hash (EventID) the `hashes` field needs
// to be present // to be present
services services