Skip to content

Commit c418db9

Browse files
committed
[fork] client-api: Re-add the MSC3440 related_by_* room event filters.
These fields were removed by MSC3856 but the filtering they describe is stable since Matrix 1.4, so the fork carries them again. The io.element.* unstable names are kept as deserialize aliases. Signed-off-by: Jason Volk <jason@zemos.net>
1 parent 2f21f03 commit c418db9

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

crates/ruma-client-api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Improvements:
1919
`unstable` to `v1`, and the retained unstable endpoint shares the v1
2020
request and response types; the response fields are now `joined`, `count`
2121
and `next_batch`.
22+
- Add the `related_by_rel_types` and `related_by_senders` fields to
23+
`RoomEventFilter`, to filter room events by their relations as stabilized
24+
in Matrix 1.4 (MSC3440). The `io.element.relation_types` and
25+
`io.element.relation_senders` unstable names are accepted as aliases.
2226

2327
Bug fixes:
2428

crates/ruma-client-api/src/filter.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ pub struct RoomEventFilter {
101101
/// [`sync_events`]: crate::sync::sync_events
102102
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
103103
pub unread_thread_notifications: bool,
104+
105+
/// A list of relation types to include.
106+
///
107+
/// An event A is included in the filter only if there exists another event B which relates to
108+
/// A with a `rel_type` which is defined in the list.
109+
#[serde(default, alias = "io.element.relation_types", skip_serializing_if = "<[_]>::is_empty")]
110+
pub related_by_rel_types: Vec<String>,
111+
112+
/// A list of senders to include.
113+
///
114+
/// An event A is included in the filter only if there exists another event B which relates to
115+
/// A, and which has a sender which is in the list.
116+
#[serde(
117+
default,
118+
alias = "io.element.relation_senders",
119+
skip_serializing_if = "<[_]>::is_empty"
120+
)]
121+
pub related_by_senders: Vec<OwnedUserId>,
104122
}
105123

106124
impl RoomEventFilter {
@@ -140,6 +158,8 @@ impl RoomEventFilter {
140158
&& self.url_filter.is_none()
141159
&& self.lazy_load_options.is_disabled()
142160
&& !self.unread_thread_notifications
161+
&& self.related_by_rel_types.is_empty()
162+
&& self.related_by_senders.is_empty()
143163
}
144164
}
145165

0 commit comments

Comments
 (0)