From 203e5136fd262ee472bb5f737fc3140876969e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:10:38 +0100 Subject: [PATCH] client-api: Move reason in membership requests out of unstable-pre-spec --- crates/ruma-client-api/CHANGELOG.md | 3 ++- crates/ruma-client-api/src/r0/membership/invite_user.rs | 8 +------- .../ruma-client-api/src/r0/membership/join_room_by_id.rs | 8 +------- .../src/r0/membership/join_room_by_id_or_alias.rs | 9 +-------- crates/ruma-client-api/src/r0/membership/leave_room.rs | 7 +------ crates/ruma-client-api/src/r0/membership/unban_user.rs | 8 +------- 6 files changed, 7 insertions(+), 36 deletions(-) diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index ae6933dc..554e5676 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -24,7 +24,7 @@ Breaking changes: Improvements: -* Add unstable support for reasons in the membership endpoints: +* Add support for reasons in the membership endpoints: ```rust r0::membership::{ @@ -43,6 +43,7 @@ Improvements: includes: * The `r0::session::get_login_types::{IdentityProvider, IdentityProviderBrand}` types * The `session::sso_login_with_provider::v3` endpoint +* Move reason support for leaving room out of `unstable-pre-spec` # 0.12.3 diff --git a/crates/ruma-client-api/src/r0/membership/invite_user.rs b/crates/ruma-client-api/src/r0/membership/invite_user.rs index 112a258b..9102ef4f 100644 --- a/crates/ruma-client-api/src/r0/membership/invite_user.rs +++ b/crates/ruma-client-api/src/r0/membership/invite_user.rs @@ -34,7 +34,6 @@ ruma_api! { pub recipient: InvitationRecipient<'a>, /// Optional reason for inviting the user. - #[cfg(feature = "unstable-pre-spec")] #[serde(skip_serializing_if = "Option::is_none")] pub reason: Option<&'a str>, } @@ -48,12 +47,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` with the given room ID and invitation recipient. pub fn new(room_id: &'a RoomId, recipient: InvitationRecipient<'a>) -> Self { - Self { - room_id, - recipient, - #[cfg(feature = "unstable-pre-spec")] - reason: None, - } + Self { room_id, recipient, reason: None } } } diff --git a/crates/ruma-client-api/src/r0/membership/join_room_by_id.rs b/crates/ruma-client-api/src/r0/membership/join_room_by_id.rs index eaa73a0b..5a5340f2 100644 --- a/crates/ruma-client-api/src/r0/membership/join_room_by_id.rs +++ b/crates/ruma-client-api/src/r0/membership/join_room_by_id.rs @@ -26,7 +26,6 @@ ruma_api! { pub third_party_signed: Option>, /// Optional reason for joining the room. - #[cfg(feature = "unstable-pre-spec")] #[serde(skip_serializing_if = "Option::is_none")] pub reason: Option<&'a str>, } @@ -42,12 +41,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` with the given room id. pub fn new(room_id: &'a RoomId) -> Self { - Self { - room_id, - third_party_signed: None, - #[cfg(feature = "unstable-pre-spec")] - reason: None, - } + Self { room_id, third_party_signed: None, reason: None } } } diff --git a/crates/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs b/crates/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs index 7583a5a6..193c7a58 100644 --- a/crates/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs +++ b/crates/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs @@ -33,7 +33,6 @@ ruma_api! { pub third_party_signed: Option>, /// Optional reason for joining the room. - #[cfg(feature = "unstable-pre-spec")] #[serde(skip_serializing_if = "Option::is_none")] pub reason: Option<&'a str>, } @@ -49,13 +48,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` with the given room ID or alias ID. pub fn new(room_id_or_alias: &'a RoomOrAliasId) -> Self { - Self { - room_id_or_alias, - server_name: &[], - third_party_signed: None, - #[cfg(feature = "unstable-pre-spec")] - reason: None, - } + Self { room_id_or_alias, server_name: &[], third_party_signed: None, reason: None } } } diff --git a/crates/ruma-client-api/src/r0/membership/leave_room.rs b/crates/ruma-client-api/src/r0/membership/leave_room.rs index de2f0545..41f5dc20 100644 --- a/crates/ruma-client-api/src/r0/membership/leave_room.rs +++ b/crates/ruma-client-api/src/r0/membership/leave_room.rs @@ -19,7 +19,6 @@ ruma_api! { pub room_id: &'a RoomId, /// Optional reason to be included as the `reason` on the subsequent membership event. - #[cfg(feature = "unstable-pre-spec")] #[serde(skip_serializing_if = "Option::is_none")] pub reason: Option<&'a str>, } @@ -33,11 +32,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` with the given room id. pub fn new(room_id: &'a RoomId) -> Self { - Self { - room_id, - #[cfg(feature = "unstable-pre-spec")] - reason: None, - } + Self { room_id, reason: None } } } diff --git a/crates/ruma-client-api/src/r0/membership/unban_user.rs b/crates/ruma-client-api/src/r0/membership/unban_user.rs index f71c11b0..5e2e6534 100644 --- a/crates/ruma-client-api/src/r0/membership/unban_user.rs +++ b/crates/ruma-client-api/src/r0/membership/unban_user.rs @@ -22,7 +22,6 @@ ruma_api! { pub user_id: &'a UserId, /// Optional reason for unbanning the user. - #[cfg(feature = "unstable-pre-spec")] #[serde(skip_serializing_if = "Option::is_none")] pub reason: Option<&'a str>, } @@ -36,12 +35,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` with the given room id and room id. pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { - Self { - room_id, - user_id, - #[cfg(feature = "unstable-pre-spec")] - reason: None, - } + Self { room_id, user_id, reason: None } } }