Merge remote-tracking branch 'upstream/main' into conduwuit-changes

This commit is contained in:
strawberry 2024-09-07 12:20:19 -04:00
commit 11155e576a
13 changed files with 24 additions and 17 deletions

View File

@ -4,7 +4,7 @@ env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
# 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:
push:

View File

@ -11,9 +11,7 @@ use serde::{
};
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
/// definition to allow request and response types to contain that said type represented by
/// the generic argument `Ev`.
/// A wrapper around `Box<RawValue>` with a generic parameter for the expected Rust type.
///
/// 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

View File

@ -9,6 +9,7 @@ use serde::{
/// Serde deserialization decorator to map empty Strings to None,
/// and forward non-empty Strings to the Deserialize implementation for T.
///
/// Useful for the typical
/// "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."

View File

@ -1,7 +1,7 @@
// This tests that the "body" fields are moved after all other fields because they
// consume the request/response.
mod newtype_body {
pub mod newtype_body {
use http::header::CONTENT_TYPE;
use ruma_common::{
api::{request, response, Metadata},
@ -47,7 +47,7 @@ mod newtype_body {
}
}
mod raw_body {
pub mod raw_body {
use http::header::CONTENT_TYPE;
use ruma_common::{
api::{request, response, Metadata},
@ -90,7 +90,7 @@ mod raw_body {
}
}
mod plain {
pub mod plain {
use http::header::CONTENT_TYPE;
use ruma_common::{
api::{request, response, Metadata},

View File

@ -147,7 +147,9 @@ pub struct EmptyMembershipData {
}
/// 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.
#[derive(Clone, PartialEq, StringEnum)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]

View File

@ -1,4 +1,5 @@
#![deny(private_in_public)]
#![deny(private_interfaces, private_bounds, unnameable_types)]
#![allow(dead_code)]
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};

View File

@ -2,6 +2,5 @@
//!
//! 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

@ -21,6 +21,7 @@ const METADATA: Metadata = metadata! {
/// Request type for the `create_join_event` endpoint.
#[request]
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
pub struct Request {
/// 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]
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
pub struct Response {
/// Full state and auth chain of the room prior to the join event.
#[ruma_api(body)]
@ -46,6 +48,7 @@ pub struct Response {
pub room_state: RoomState,
}
#[allow(deprecated)]
impl Request {
/// 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 {
@ -53,6 +56,7 @@ impl Request {
}
}
#[allow(deprecated)]
impl Response {
/// Creates a new `Response` with the given room state.
pub fn new(room_state: RoomState) -> Self {

View File

@ -2,6 +2,5 @@
//!
//! 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

@ -21,6 +21,7 @@ const METADATA: Metadata = metadata! {
/// Request type for the `create_leave_event` endpoint.
#[request]
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
pub struct Request {
/// 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]
#[derive(Default)]
#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
pub struct Response {
/// An empty object.
///
@ -49,6 +51,7 @@ pub struct Response {
pub empty: Empty,
}
#[allow(deprecated)]
impl Request {
/// 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 {
@ -56,6 +59,7 @@ impl Request {
}
}
#[allow(deprecated)]
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {

View File

@ -101,7 +101,7 @@ pub fn expand_derive_request(input: ItemStruct) -> syn::Result<TokenStream> {
#types_impls
#[allow(deprecated)]
#[cfg(tests)]
#[cfg(test)]
mod __request {
#test
}
@ -272,9 +272,8 @@ impl Request {
let path_fields = self.path_fields().map(|f| f.ident.as_ref().unwrap().to_string());
let mut tests = quote! {
#[::std::prelude::v1::test]
#[allow(deprecated)]
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),*];
::std::assert_eq!(
path_params, request_path_fields,
@ -288,7 +287,7 @@ impl Request {
#[::std::prelude::v1::test]
fn request_is_not_get() {
::std::assert_ne!(
METADATA.method, #http::Method::GET,
super::METADATA.method, #http::Method::GET,
"GET endpoints can't have body fields",
);
}

View File

@ -1,4 +1,4 @@
[toolchain]
# 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"]

View File

@ -15,7 +15,7 @@ use serde::Deserialize;
use serde_json::from_str as from_json_str;
// 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 ci;