diff --git a/src/service/rooms/timeline/create.rs b/src/service/rooms/timeline/create.rs index 204e16ad..fc275c1a 100644 --- a/src/service/rooms/timeline/create.rs +++ b/src/service/rooms/timeline/create.rs @@ -267,9 +267,9 @@ pub async fn create_hash_and_sign_event( | _ => Err!(Request(Unknown(warn!("Signing event failed: {e}")))), }; } - // Check with the policy server // Generate event id pdu.event_id = gen_event_id(&pdu_json, &room_version_id)?; + // Check with the policy server pdu_json.insert("event_id".into(), CanonicalJsonValue::String(pdu.event_id.clone().into())); if room_id.is_some() { trace!( @@ -295,32 +295,6 @@ pub async fn create_hash_and_sign_event( } } - // Check with the policy server - if room_id.is_some() { - trace!( - "Checking event {} in room {} with policy server", - pdu.event_id, - pdu.room_id.as_ref().map_or("None", |id| id.as_str()) - ); - match self - .services - .event_handler - .ask_policy_server(&pdu, &pdu_json, &pdu.room_id_or_hash()) - .await - { - | Ok(true) => {}, - | Ok(false) => { - return Err!(Request(Forbidden(debug_warn!( - "Policy server marked this event as spam" - )))); - }, - | Err(e) => { - // fail open - warn!("Failed to check event with policy server: {e}"); - }, - } - } - // Generate short event id trace!( "Generating short event ID for {} in room {}",