From 489820303e9f04ba62112623620e8072a42e16d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 1 Oct 2022 00:25:11 +0200 Subject: [PATCH] client-api: Stabilize support for private read receipts --- crates/ruma-client-api/CHANGELOG.md | 3 ++ crates/ruma-client-api/Cargo.toml | 1 - .../src/read_marker/set_read_marker.rs | 29 ++----------------- .../src/receipt/create_receipt.rs | 10 +++---- crates/ruma/Cargo.toml | 5 +--- 5 files changed, 10 insertions(+), 38 deletions(-) diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index d93ed4c9..a6166f92 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -4,6 +4,8 @@ Breaking changes: * Remove `sync::sync_events::v3::DeviceLists` re-export * Use `sync::sync_events::DeviceLists` instead +* `fully_read` field in `read_marker::set_read_marker` is no longer required + * Remove the `fully_read` argument from `read_marker::set_read_marker::Request::new` Improvements: @@ -11,6 +13,7 @@ Improvements: * Remove the `unstable-msc3440` feature * The fields added to `RoomEventFilter` were removed by MSC3856 * Add support for the threads list API (MSC3856 / Matrix 1.4) +* Stabilize support for private read receipts # 0.15.1 diff --git a/crates/ruma-client-api/Cargo.toml b/crates/ruma-client-api/Cargo.toml index 64026a59..efd85d5f 100644 --- a/crates/ruma-client-api/Cargo.toml +++ b/crates/ruma-client-api/Cargo.toml @@ -19,7 +19,6 @@ rustdoc-args = ["--cfg", "docsrs"] compat = [] unstable-exhaustive-types = [] unstable-msc2246 = [] -unstable-msc2285 = [] unstable-msc2666 = [] unstable-msc2448 = [] unstable-msc2654 = [] diff --git a/crates/ruma-client-api/src/read_marker/set_read_marker.rs b/crates/ruma-client-api/src/read_marker/set_read_marker.rs index aa98515f..1dbf91c3 100644 --- a/crates/ruma-client-api/src/read_marker/set_read_marker.rs +++ b/crates/ruma-client-api/src/read_marker/set_read_marker.rs @@ -28,15 +28,6 @@ pub mod v3 { #[ruma_api(path)] pub room_id: &'a RoomId, - /// The event ID the fully-read marker should be located at. - /// - /// The event MUST belong to the room. - /// - /// With the `unstable-msc2285` feature, this field is optional. - #[cfg(not(feature = "unstable-msc2285"))] - #[serde(rename = "m.fully_read")] - pub fully_read: &'a EventId, - /// The event ID the fully-read marker should be located at. /// /// The event MUST belong to the room. @@ -44,12 +35,9 @@ pub mod v3 { /// This is equivalent to calling the [`create_receipt`] endpoint with a /// [`ReceiptType::FullyRead`]. /// - /// Without the `unstable-msc2285` feature, this field is required. - /// /// [`create_receipt`]: crate::receipt::create_receipt /// [`ReceiptType::FullyRead`]: crate::receipt::create_receipt::v3::ReceiptType::FullyRead - #[cfg(feature = "unstable-msc2285")] - #[serde(rename = "m.fully_read")] + #[serde(rename = "m.fully_read", skip_serializing_if = "Option::is_none")] pub fully_read: Option<&'a EventId>, /// The event ID to set the public read receipt location at. @@ -69,8 +57,7 @@ pub mod v3 { /// /// [`create_receipt`]: crate::receipt::create_receipt /// [`ReceiptType::ReadPrivate`]: crate::receipt::create_receipt::v3::ReceiptType::ReadPrivate - #[cfg(feature = "unstable-msc2285")] - #[serde(rename = "org.matrix.msc2285.read.private", alias = "m.read.private", skip_serializing_if = "Option::is_none")] + #[serde(rename = "m.read.private", skip_serializing_if = "Option::is_none")] pub private_read_receipt: Option<&'a EventId>, } @@ -81,19 +68,7 @@ pub mod v3 { } impl<'a> Request<'a> { - /// Creates a new `Request` with the given room ID and fully read event ID. - /// - /// With the `unstable-msc2285` feature, this method doesn't have the `fully_read` - /// parameter. - #[cfg(not(feature = "unstable-msc2285"))] - pub fn new(room_id: &'a RoomId, fully_read: &'a EventId) -> Self { - Self { room_id, fully_read, read_receipt: None } - } - /// Creates a new `Request` with the given room ID. - /// - /// Without the `unstable-msc2285` feature, this method takes a `fully_read` parameter. - #[cfg(feature = "unstable-msc2285")] pub fn new(room_id: &'a RoomId) -> Self { Self { room_id, fully_read: None, read_receipt: None, private_read_receipt: None } } diff --git a/crates/ruma-client-api/src/receipt/create_receipt.rs b/crates/ruma-client-api/src/receipt/create_receipt.rs index 3dc4da0b..d84843fc 100644 --- a/crates/ruma-client-api/src/receipt/create_receipt.rs +++ b/crates/ruma-client-api/src/receipt/create_receipt.rs @@ -70,7 +70,7 @@ pub mod v3 { /// /// This receipt is federated to other users. /// - /// [public read receipt]: https://spec.matrix.org/v1.3/client-server-api/#receipts + /// [public read receipt]: https://spec.matrix.org/v1.4/client-server-api/#receipts #[ruma_enum(rename = "m.read")] Read, @@ -81,9 +81,8 @@ pub mod v3 { /// This read receipt is not federated so only the user and their homeserver /// are aware of it. /// - /// [private read receipt]: https://github.com/matrix-org/matrix-spec-proposals/pull/2285 - #[cfg(feature = "unstable-msc2285")] - #[ruma_enum(rename = "org.matrix.msc2285.read.private", alias = "m.read.private")] + /// [private read receipt]: https://spec.matrix.org/v1.4/client-server-api/#private-read-receipts + #[ruma_enum(rename = "m.read.private")] ReadPrivate, /// A [fully read marker]. @@ -93,8 +92,7 @@ pub mod v3 { /// This is actually not a receipt, but a piece of room account data. It is /// provided here for convenience. /// - /// [fully read marker]: https://spec.matrix.org/v1.3/client-server-api/#fully-read-markers - #[cfg(feature = "unstable-msc2285")] + /// [fully read marker]: https://spec.matrix.org/v1.4/client-server-api/#fully-read-markers #[ruma_enum(rename = "m.fully_read")] FullyRead, diff --git a/crates/ruma/Cargo.toml b/crates/ruma/Cargo.toml index c4445a13..3d067633 100644 --- a/crates/ruma/Cargo.toml +++ b/crates/ruma/Cargo.toml @@ -119,10 +119,7 @@ unstable-extensible-events = [ ] unstable-msc1767 = ["ruma-common/unstable-msc1767"] unstable-msc2246 = ["ruma-client-api?/unstable-msc2246"] -unstable-msc2285 = [ - "ruma-client-api?/unstable-msc2285", - "ruma-common/unstable-msc2285" -] +unstable-msc2285 = ["ruma-common/unstable-msc2285"] unstable-msc2448 = [ "ruma-client-api?/unstable-msc2448", "ruma-common/unstable-msc2448",