From b875e1c977f876343b60c12f501ead8be2c88905 Mon Sep 17 00:00:00 2001 From: Jonas Richard Richter Date: Fri, 27 Jun 2025 14:57:16 +0200 Subject: [PATCH 1/2] feat(notification): add room topic to NotificationItem and NotificationRoomInfo structs --- bindings/matrix-sdk-ffi/CHANGELOG.md | 18 ++++++++++++------ bindings/matrix-sdk-ffi/src/notification.rs | 2 ++ crates/matrix-sdk-ui/CHANGELOG.md | 6 ++++++ .../matrix-sdk-ui/src/notification_client.rs | 3 +++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/bindings/matrix-sdk-ffi/CHANGELOG.md b/bindings/matrix-sdk-ffi/CHANGELOG.md index f4042041d58..f0314edabe4 100644 --- a/bindings/matrix-sdk-ffi/CHANGELOG.md +++ b/bindings/matrix-sdk-ffi/CHANGELOG.md @@ -6,11 +6,17 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - ReleaseDate +### Features + +- Add `NotificationRoomInfo::topic` to the `NotificationRoomInfo` struct, which + contains the topic of the room. This is useful for displaying the room topic + in notifications. + ### Refactor - Adjust features in the `matrix-sdk-ffi` crate to expose more platform-specific knobs. Previously the `matrix-sdk-ffi` was configured primarily by target configs, choosing - between the tls flavor (`rustls-tls` or `native-tls`) and features like `sentry` based + between the tls flavor (`rustls-tls` or `native-tls`) and features like `sentry` based purely on the target. As we work to add an additional Wasm target to this crate, the cross product of target specific features has become somewhat chaotic, and we have shifted to externalize these choices as feature flags. @@ -20,7 +26,7 @@ All notable changes to this project will be documented in this file. iOS: `"bundled-sqlite,unstable-msc4274,native-tls,sentry"` Javascript/Wasm: `"unstable-msc4274,native-tls"` - In the future additional choices (such as session storage, `sqlite` and `indexeddb`) + In the future additional choices (such as session storage, `sqlite` and `indexeddb`) will likely be added as well. Breaking changes: @@ -38,7 +44,7 @@ Breaking changes: Breaking changes: -- `Client::send_call_notification_if_needed` now returns `Result` instead of `Result<()>` so we can check if +- `Client::send_call_notification_if_needed` now returns `Result` instead of `Result<()>` so we can check if the event was sent. - `Client::upload_avatar` and `Timeline::send_attachment` now may fail if a file too large for the homeserver media config is uploaded. @@ -53,8 +59,8 @@ Breaking changes: Additions: -- `Client::subscribe_to_room_info` allows clients to subscribe to room info updates in rooms which may not be known yet. - This is useful when displaying a room preview for an unknown room, so when we receive any membership change for it, +- `Client::subscribe_to_room_info` allows clients to subscribe to room info updates in rooms which may not be known yet. + This is useful when displaying a room preview for an unknown room, so when we receive any membership change for it, we can automatically update the UI. - `Client::get_max_media_upload_size` to get the max size of a request sent to the homeserver so we can tweak our media uploads by compressing/transcoding the media. @@ -74,7 +80,7 @@ Additions: Breaking changes: -- `contacts` has been removed from `OidcConfiguration` (it was unused since the switch to OAuth). +- `contacts` has been removed from `OidcConfiguration` (it was unused since the switch to OAuth). ## [0.11.0] - 2025-04-11 diff --git a/bindings/matrix-sdk-ffi/src/notification.rs b/bindings/matrix-sdk-ffi/src/notification.rs index ca83703c865..0c806dc4079 100644 --- a/bindings/matrix-sdk-ffi/src/notification.rs +++ b/bindings/matrix-sdk-ffi/src/notification.rs @@ -31,6 +31,7 @@ pub struct NotificationRoomInfo { pub display_name: String, pub avatar_url: Option, pub canonical_alias: Option, + pub topic: Option, pub join_rule: Option, pub joined_members_count: u64, pub is_encrypted: Option, @@ -73,6 +74,7 @@ impl NotificationItem { display_name: item.room_computed_display_name, avatar_url: item.room_avatar_url, canonical_alias: item.room_canonical_alias, + topic: item.room_topic, join_rule: item.room_join_rule.map(TryInto::try_into).transpose().ok().flatten(), joined_members_count: item.joined_members_count, is_encrypted: item.is_room_encrypted, diff --git a/crates/matrix-sdk-ui/CHANGELOG.md b/crates/matrix-sdk-ui/CHANGELOG.md index 0e9fcaee88a..a793ffbab7f 100644 --- a/crates/matrix-sdk-ui/CHANGELOG.md +++ b/crates/matrix-sdk-ui/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - ReleaseDate +### Features + +- Add `NotificationItem::room_topic` to the `NotificationItem` struct, which + contains the topic of the room. This is useful for displaying the room topic + in notifications. + ## [0.12.0] - 2025-06-10 ### Refactor diff --git a/crates/matrix-sdk-ui/src/notification_client.rs b/crates/matrix-sdk-ui/src/notification_client.rs index 5e1f92d0b80..4e073f928ef 100644 --- a/crates/matrix-sdk-ui/src/notification_client.rs +++ b/crates/matrix-sdk-ui/src/notification_client.rs @@ -909,6 +909,8 @@ pub struct NotificationItem { pub room_avatar_url: Option, /// Room canonical alias. pub room_canonical_alias: Option, + /// Room topic. + pub room_topic: Option, /// Room join rule. /// /// Set to `None` if the join rule for this room is not available. @@ -1008,6 +1010,7 @@ impl NotificationItem { room_computed_display_name: room.display_name().await?.to_string(), room_avatar_url: room.avatar_url().map(|s| s.to_string()), room_canonical_alias: room.canonical_alias().map(|c| c.to_string()), + room_topic: room.topic(), room_join_rule: room.join_rule(), is_direct_message_room: room.is_direct().await?, is_room_encrypted: room From 7e6ed35b32609e54111afc418e623e35a31f4034 Mon Sep 17 00:00:00 2001 From: Jonas Richard Richter Date: Fri, 27 Jun 2025 15:03:30 +0200 Subject: [PATCH 2/2] chore(changelog): add pull request reference for NotificationItem room topic addition --- bindings/matrix-sdk-ffi/CHANGELOG.md | 2 +- crates/matrix-sdk-ui/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/matrix-sdk-ffi/CHANGELOG.md b/bindings/matrix-sdk-ffi/CHANGELOG.md index f0314edabe4..4770846eb1e 100644 --- a/bindings/matrix-sdk-ffi/CHANGELOG.md +++ b/bindings/matrix-sdk-ffi/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file. - Add `NotificationRoomInfo::topic` to the `NotificationRoomInfo` struct, which contains the topic of the room. This is useful for displaying the room topic - in notifications. + in notifications. ([#5300](https://github.com/matrix-org/matrix-rust-sdk/pull/5300)) ### Refactor diff --git a/crates/matrix-sdk-ui/CHANGELOG.md b/crates/matrix-sdk-ui/CHANGELOG.md index a793ffbab7f..f6dd811a7bb 100644 --- a/crates/matrix-sdk-ui/CHANGELOG.md +++ b/crates/matrix-sdk-ui/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file. - Add `NotificationItem::room_topic` to the `NotificationItem` struct, which contains the topic of the room. This is useful for displaying the room topic - in notifications. + in notifications. ([#5300](https://github.com/matrix-org/matrix-rust-sdk/pull/5300)) ## [0.12.0] - 2025-06-10