From 0a37df11cd6eab42741f5dd05d196a0ac8295390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 28 Dec 2024 15:50:28 +0100 Subject: [PATCH] events: Add unstable support for is_animated image flag According to MSC4230. --- crates/ruma-events/CHANGELOG.md | 4 ++++ crates/ruma-events/Cargo.toml | 1 + crates/ruma-events/src/room.rs | 9 +++++++++ crates/ruma/Cargo.toml | 2 ++ 4 files changed, 16 insertions(+) diff --git a/crates/ruma-events/CHANGELOG.md b/crates/ruma-events/CHANGELOG.md index 405df9c2..563a0f43 100644 --- a/crates/ruma-events/CHANGELOG.md +++ b/crates/ruma-events/CHANGELOG.md @@ -12,6 +12,10 @@ event. - `make_replacement` does not take the replied-to message anymore. +Improvements: + +- Add unstable support for the `is_animated` flag for images, according to MSC4230. + # 0.30.0 Breaking changes: diff --git a/crates/ruma-events/Cargo.toml b/crates/ruma-events/Cargo.toml index 13f760d4..c1afde70 100644 --- a/crates/ruma-events/Cargo.toml +++ b/crates/ruma-events/Cargo.toml @@ -44,6 +44,7 @@ unstable-msc3956 = ["unstable-msc1767"] unstable-msc4075 = ["unstable-msc3401"] unstable-msc4095 = [] unstable-msc4171 = [] +unstable-msc4230 = [] unstable-pdu = [] # Allow some mandatory fields to be missing, defaulting them to an empty string diff --git a/crates/ruma-events/src/room.rs b/crates/ruma-events/src/room.rs index 818212a6..25b76cb6 100644 --- a/crates/ruma-events/src/room.rs +++ b/crates/ruma-events/src/room.rs @@ -105,6 +105,15 @@ pub struct ImageInfo { #[cfg(feature = "unstable-msc2448")] #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] pub blurhash: Option, + + /// Whether the image is animated. + /// + /// This uses the unstable prefix in [MSC4230]. + /// + /// [MSC4230]: https://github.com/matrix-org/matrix-spec-proposals/pull/4230 + #[cfg(feature = "unstable-msc4230")] + #[serde(rename = "org.matrix.msc4230.is_animated", skip_serializing_if = "Option::is_none")] + pub is_animated: Option, } impl ImageInfo { diff --git a/crates/ruma/Cargo.toml b/crates/ruma/Cargo.toml index 68624ad7..477e4e0f 100644 --- a/crates/ruma/Cargo.toml +++ b/crates/ruma/Cargo.toml @@ -270,6 +270,7 @@ unstable-msc4140 = ["ruma-client-api?/unstable-msc4140"] unstable-msc4171 = ["ruma-events?/unstable-msc4171"] unstable-msc4186 = ["ruma-client-api?/unstable-msc4186"] unstable-msc4210 = ["ruma-common/unstable-msc4210"] +unstable-msc4230 = ["ruma-events?/unstable-msc4230"] unstable-pdu = ["ruma-events?/unstable-pdu"] unstable-unspecified = [ "ruma-common/unstable-unspecified", @@ -322,6 +323,7 @@ __unstable-mscs = [ "unstable-msc4140", "unstable-msc4171", "unstable-msc4186", + "unstable-msc4230", ] __ci = [ "full",