federation-api: Deprecate v1/send_join and v1/send_leave

According to a spec clarification
This commit is contained in:
Kévin Commaille 2023-05-24 18:34:26 +02:00 committed by Kévin Commaille
parent 2296f16ea0
commit 9dd55ae3bc
6 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,9 @@
# [unreleased]
Improvements:
* Deprecate the `v1/send_join` and `v1/send_leave` endpoints according to a spec clarification
# 0.7.1
Improvements:

View File

@ -2,5 +2,6 @@
//!
//! Send a join event to a resident server.
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
pub mod v1;
pub mod v2;

View File

@ -15,6 +15,7 @@ const METADATA: Metadata = metadata! {
authentication: ServerSignatures,
history: {
1.0 => "/_matrix/federation/v1/send_join/:room_id/:event_id",
1.0 => deprecated,
}
};
@ -109,6 +110,7 @@ impl RoomState {
}
}
#[allow(deprecated)]
#[cfg(all(test, feature = "server", not(feature = "unstable-unspecified")))]
mod tests {
use ruma_common::api::OutgoingResponse;

View File

@ -2,5 +2,6 @@
//!
//! Submit a signed leave event to the receiving server for it to accept it into the room's graph.
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
pub mod v1;
pub mod v2;

View File

@ -18,6 +18,7 @@ const METADATA: Metadata = metadata! {
authentication: ServerSignatures,
history: {
1.0 => "/_matrix/federation/v1/send_leave/:room_id/:event_id",
1.0 => deprecated,
}
};

View File

@ -74,6 +74,7 @@ mod tests {
use serde_json::json;
use super::{deserialize, serialize};
#[allow(deprecated)]
use crate::membership::create_join_event::v1::RoomState;
#[test]
@ -87,6 +88,7 @@ mod tests {
}
]);
#[allow(deprecated)]
let RoomState { origin, auth_chain, state, event } = deserialize(response).unwrap();
assert_eq!(origin, "example.com");
assert_matches!(auth_chain.as_slice(), []);
@ -96,6 +98,7 @@ mod tests {
#[test]
fn serialize_response() {
#[allow(deprecated)]
let room_state = RoomState {
origin: "matrix.org".into(),
auth_chain: Vec::new(),
@ -121,6 +124,7 @@ mod tests {
#[test]
fn too_short_array() {
let json = json!([200]);
#[allow(deprecated)]
let failed_room_state = deserialize::<RoomState, _>(json);
assert_eq!(
failed_room_state.unwrap_err().to_string(),
@ -135,6 +139,7 @@ mod tests {
"auth_chain": [],
"state": []
});
#[allow(deprecated)]
let failed_room_state = deserialize::<RoomState, _>(json);
assert_eq!(
@ -146,6 +151,7 @@ mod tests {
#[test]
fn too_long_array() {
let json = json!([200, { "origin": "", "auth_chain": [], "state": [] }, 200]);
#[allow(deprecated)]
let RoomState { origin, auth_chain, state, event } = deserialize(json).unwrap();
assert_eq!(origin, "");
assert_matches!(auth_chain.as_slice(), []);