fix: Remove redundant check 2

This may look scary, but this is safe because event auth performs the same check, and will reject the event if it doesn't reference the create event correctly.
This commit is contained in:
timedout authored and Jade Ellis committed 2026-06-27 20:16:46 +01:00
1 parent 9292f16cd7
commit 3a7259250b
1 file changed
-17
@@ -10,7 +10,6 @@ use futures::StreamExt;
use ruma::{
EventId, OwnedEventId, RoomId, ServerName,
api::federation::event::{get_room_state, get_room_state_ids},
events::StateEventType,
};
use crate::{conduwuit::utils::stream::BroadbandExt, rooms::short::ShortStateKey};
@@ -158,22 +157,6 @@ impl super::Service {
}
}
// The original create event must still be in the state
let create_shortstatekey = self
.services
.short
.get_shortstatekey(&StateEventType::RoomCreate, "")
.await?;
let create_event_id = state.get(&create_shortstatekey).map(AsRef::as_ref);
if create_event_id != Some(create_event.event_id()) {
return Err!(Request(Forbidden(
"Incoming event refers to wrong create event: expected {}, got: \
{create_event_id:?}",
create_event.event_id()
)));
}
Ok(Some(state))
}