Merge remote-tracking branch 'upstream/main' into conduwuit-changes
This commit is contained in:
commit
11155e576a
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -4,7 +4,7 @@ env:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
||||||
# Keep in sync with version in `rust-toolchain.toml` and `xtask/src/ci.rs`
|
# Keep in sync with version in `rust-toolchain.toml` and `xtask/src/ci.rs`
|
||||||
NIGHTLY: nightly-2024-07-29
|
NIGHTLY: nightly-2024-09-06
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -11,9 +11,7 @@ use serde::{
|
|||||||
};
|
};
|
||||||
use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue};
|
use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue};
|
||||||
|
|
||||||
/// A wrapper around `Box<RawValue>`, to be used in place of any type in the Matrix endpoint
|
/// A wrapper around `Box<RawValue>` with a generic parameter for the expected Rust type.
|
||||||
/// definition to allow request and response types to contain that said type represented by
|
|
||||||
/// the generic argument `Ev`.
|
|
||||||
///
|
///
|
||||||
/// Ruma offers the `Raw` wrapper to enable passing around JSON text that is only partially
|
/// Ruma offers the `Raw` wrapper to enable passing around JSON text that is only partially
|
||||||
/// validated. This is useful when a client receives events that do not follow the spec perfectly
|
/// validated. This is useful when a client receives events that do not follow the spec perfectly
|
||||||
|
@ -9,6 +9,7 @@ use serde::{
|
|||||||
|
|
||||||
/// Serde deserialization decorator to map empty Strings to None,
|
/// Serde deserialization decorator to map empty Strings to None,
|
||||||
/// and forward non-empty Strings to the Deserialize implementation for T.
|
/// and forward non-empty Strings to the Deserialize implementation for T.
|
||||||
|
///
|
||||||
/// Useful for the typical
|
/// Useful for the typical
|
||||||
/// "A room with an X event with an absent, null, or empty Y field
|
/// "A room with an X event with an absent, null, or empty Y field
|
||||||
/// should be treated the same as a room with no such event."
|
/// should be treated the same as a room with no such event."
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This tests that the "body" fields are moved after all other fields because they
|
// This tests that the "body" fields are moved after all other fields because they
|
||||||
// consume the request/response.
|
// consume the request/response.
|
||||||
|
|
||||||
mod newtype_body {
|
pub mod newtype_body {
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
@ -47,7 +47,7 @@ mod newtype_body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod raw_body {
|
pub mod raw_body {
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
@ -90,7 +90,7 @@ mod raw_body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod plain {
|
pub mod plain {
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
|
@ -147,7 +147,9 @@ pub struct EmptyMembershipData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This is the optional value for an empty membership event content:
|
/// This is the optional value for an empty membership event content:
|
||||||
/// [`CallMemberEventContent::Empty`]. It is used when the user disconnected and a Future ([MSC4140](https://github.com/matrix-org/matrix-spec-proposals/pull/4140))
|
/// [`CallMemberEventContent::Empty`].
|
||||||
|
///
|
||||||
|
/// It is used when the user disconnected and a Future ([MSC4140](https://github.com/matrix-org/matrix-spec-proposals/pull/4140))
|
||||||
/// was used to update the membership after the client was not reachable anymore.
|
/// was used to update the membership after the client was not reachable anymore.
|
||||||
#[derive(Clone, PartialEq, StringEnum)]
|
#[derive(Clone, PartialEq, StringEnum)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#![deny(private_in_public)]
|
#![deny(private_interfaces, private_bounds, unnameable_types)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use ruma_macros::EventContent;
|
use ruma_macros::EventContent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -2,6 +2,5 @@
|
|||||||
//!
|
//!
|
||||||
//! Send a join event to a resident server.
|
//! 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 v1;
|
||||||
pub mod v2;
|
pub mod v2;
|
||||||
|
@ -21,6 +21,7 @@ const METADATA: Metadata = metadata! {
|
|||||||
|
|
||||||
/// Request type for the `create_join_event` endpoint.
|
/// Request type for the `create_join_event` endpoint.
|
||||||
#[request]
|
#[request]
|
||||||
|
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
/// The room ID that is about to be joined.
|
/// The room ID that is about to be joined.
|
||||||
///
|
///
|
||||||
@ -39,6 +40,7 @@ pub struct Request {
|
|||||||
|
|
||||||
/// Response type for the `create_join_event` endpoint.
|
/// Response type for the `create_join_event` endpoint.
|
||||||
#[response]
|
#[response]
|
||||||
|
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
/// Full state and auth chain of the room prior to the join event.
|
/// Full state and auth chain of the room prior to the join event.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
@ -46,6 +48,7 @@ pub struct Response {
|
|||||||
pub room_state: RoomState,
|
pub room_state: RoomState,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates a new `Request` from the given room ID, event ID and PDU.
|
/// Creates a new `Request` from the given room ID, event ID and PDU.
|
||||||
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
|
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
|
||||||
@ -53,6 +56,7 @@ impl Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given room state.
|
/// Creates a new `Response` with the given room state.
|
||||||
pub fn new(room_state: RoomState) -> Self {
|
pub fn new(room_state: RoomState) -> Self {
|
||||||
|
@ -2,6 +2,5 @@
|
|||||||
//!
|
//!
|
||||||
//! Submit a signed leave event to the receiving server for it to accept it into the room's graph.
|
//! 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 v1;
|
||||||
pub mod v2;
|
pub mod v2;
|
||||||
|
@ -21,6 +21,7 @@ const METADATA: Metadata = metadata! {
|
|||||||
|
|
||||||
/// Request type for the `create_leave_event` endpoint.
|
/// Request type for the `create_leave_event` endpoint.
|
||||||
#[request]
|
#[request]
|
||||||
|
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
/// The room ID that is about to be left.
|
/// The room ID that is about to be left.
|
||||||
///
|
///
|
||||||
@ -40,6 +41,7 @@ pub struct Request {
|
|||||||
/// Response type for the `create_leave_event` endpoint.
|
/// Response type for the `create_leave_event` endpoint.
|
||||||
#[response]
|
#[response]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
/// An empty object.
|
/// An empty object.
|
||||||
///
|
///
|
||||||
@ -49,6 +51,7 @@ pub struct Response {
|
|||||||
pub empty: Empty,
|
pub empty: Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates a new `Request` from the given room ID, event ID and PDU.
|
/// Creates a new `Request` from the given room ID, event ID and PDU.
|
||||||
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
|
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
|
||||||
@ -56,6 +59,7 @@ impl Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates an empty `Response`.
|
/// Creates an empty `Response`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -101,7 +101,7 @@ pub fn expand_derive_request(input: ItemStruct) -> syn::Result<TokenStream> {
|
|||||||
#types_impls
|
#types_impls
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
#[cfg(tests)]
|
#[cfg(test)]
|
||||||
mod __request {
|
mod __request {
|
||||||
#test
|
#test
|
||||||
}
|
}
|
||||||
@ -272,9 +272,8 @@ impl Request {
|
|||||||
let path_fields = self.path_fields().map(|f| f.ident.as_ref().unwrap().to_string());
|
let path_fields = self.path_fields().map(|f| f.ident.as_ref().unwrap().to_string());
|
||||||
let mut tests = quote! {
|
let mut tests = quote! {
|
||||||
#[::std::prelude::v1::test]
|
#[::std::prelude::v1::test]
|
||||||
#[allow(deprecated)]
|
|
||||||
fn path_parameters() {
|
fn path_parameters() {
|
||||||
let path_params = METADATA._path_parameters();
|
let path_params = super::METADATA._path_parameters();
|
||||||
let request_path_fields: &[&::std::primitive::str] = &[#(#path_fields),*];
|
let request_path_fields: &[&::std::primitive::str] = &[#(#path_fields),*];
|
||||||
::std::assert_eq!(
|
::std::assert_eq!(
|
||||||
path_params, request_path_fields,
|
path_params, request_path_fields,
|
||||||
@ -288,7 +287,7 @@ impl Request {
|
|||||||
#[::std::prelude::v1::test]
|
#[::std::prelude::v1::test]
|
||||||
fn request_is_not_get() {
|
fn request_is_not_get() {
|
||||||
::std::assert_ne!(
|
::std::assert_ne!(
|
||||||
METADATA.method, #http::Method::GET,
|
super::METADATA.method, #http::Method::GET,
|
||||||
"GET endpoints can't have body fields",
|
"GET endpoints can't have body fields",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
# Keep in sync with version in `xtask/src/ci.rs` and `.github/workflows/ci.yml`
|
# Keep in sync with version in `xtask/src/ci.rs` and `.github/workflows/ci.yml`
|
||||||
channel = "nightly-2024-07-29"
|
channel = "nightly-2024-09-06"
|
||||||
components = ["rustfmt", "clippy"]
|
components = ["rustfmt", "clippy"]
|
||||||
|
@ -15,7 +15,7 @@ use serde::Deserialize;
|
|||||||
use serde_json::from_str as from_json_str;
|
use serde_json::from_str as from_json_str;
|
||||||
|
|
||||||
// Keep in sync with version in `rust-toolchain.toml` and `.github/workflows/ci.yml`
|
// Keep in sync with version in `rust-toolchain.toml` and `.github/workflows/ci.yml`
|
||||||
const NIGHTLY: &str = "nightly-2024-07-29";
|
const NIGHTLY: &str = "nightly-2024-09-06";
|
||||||
|
|
||||||
mod cargo;
|
mod cargo;
|
||||||
mod ci;
|
mod ci;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user